英文:
ERROR: More positional parameters found than defined
问题
尝试通过proc sql向数据库表插入值。我的值是宏。在其中一个宏中,它包含一个带有逗号的文本。所以我得到了下面的错误
错误:找到的位置参数比定义的多。
%let m_msi=123465;
%let m_msg=Hi, Kindly help me to resolve the issue;
insert into my_table
(
Column1,
Column2
)
values
(
%tslit(%sysfunc(strip(&m_msi.))),
%tslit(%sysfunc(strip(&m_msg.)))
)
英文:
Trying to insert values to a database table through proc sql. my values are macros. In one of the macro it contain a text which has comma in between. So I'm getting below error
> ERROR: More positional parameters found than defined.
%let m_msi=123465;
%let m_msg=Hi, Kindly help me to resolve the issue;
insert into my_table
(
Column1,
Column2
)
values
(
%tslit(%sysfunc(strip(&m_msi.))),
%tslit(%sysfunc(strip(&m_msg.)))
)
答案1
得分: 1
我认为M_MSG中的逗号是引发问题的原因。
尝试像下面这样添加%STR或%NRSTR。
%let m_msg=%str(Hi, Kindly help me to resolve the issue);
您还可以尝试%QSYSFUNC。
%Qsysfunc(strip(&m_msi.))
英文:
I think the comma in M_MSG is causing the problem.
%let m_msg=Hi, Kindly help me to resolve the issue;
Try adding %STR or %NRSTR as follows.
%let m_msg=%str(Hi, Kindly help me to resolve the issue);
You could also try %QSYSFUNC
%Qsysfunc(strip(&m_msi.))
答案2
得分: 0
你在插入时需要引用数值。
proc sql;
create table my_table
(
column1 char(200),
column2 char(200)
);
quit;
%let m_msi=123465;
%let m_msg=嗨,请帮我解决这个问题;
proc sql;
insert into my_table (
Column1,
Column2
)
values (
"&m_msi",
"&m_msg"
);
quit;
英文:
You need to quote values when inserting.
proc sql;
create table my_table
(
column1 char(200),
column2 char(200)
);
quit;
%let m_msi=123465;
%let m_msg=Hi, Kindly help me to resolve the issue;
proc sql;
insert into my_table (
Column1,
Column2
)
values (
"&m_msi",
"&m_msg"
);
quit;
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论