如何使以下声明有效?
%let qccomment= /n ORACLE execute error: ORA-20001: User xyxlll
does not have acccess to the gva BA_DEV ORA-06512: at
"M_UTIL", line 51 ORA-06512: at line 1. /nTable XY_XY does not exist
(Oracle extract data failed);
%put &qccomment;
data null;
i ="&qccomment";
put i;
run;
它返回错误 错误386-185:期待算术表达式。
ERROR 200-322:符号无法识别,将被忽略。
ERROR 76-322:语法错误,语句将被忽略。
答案 0 :(得分:2)
您可以使用SYMGET()函数检索宏变量的值,而不必担心任何宏引用(至少在执行检索的步骤中)。
data _null_;
i = symget('qcomment');
put i= ;
run;
如果确实需要引用宏变量的值并使用它来生成带引号的字符串,那么使用QUOTE()函数确保任何嵌入的引号都正确加倍,以便生成的字符串有效string literal。
data _null_;
put %sysfunc(quote(&qcomment));
run;
答案 1 :(得分:0)
您需要使用宏引用功能来解决这个问题,
/* Using %BQUOTE in let statement to quote the string */
%let qccomment= %bquote(/n ORACLE execute error: ORA-20001: User xyxlll
does not have acccess to the gva BA_DEV ORA-06512: at
"M_UTIL", line 51 ORA-06512: at line 1. /nTable XY_XY does not exist
(Oracle extract data failed));
%put &qccomment;
data null;
i ="&qccomment";
put i;
run;
<强> LOG 强>
11 %let qccomment= %bquote(/n ORACLE execute error: ORA-20001: User xyxlll
12 does not have acccess to the gva BA_DEV ORA-06512: at
13 "M_UTIL", line 51 ORA-06512: at line 1. /nTable XY_XY does not exist
14 (Oracle extract data failed));
15
16 %put &qccomment;
/n ORACLE execute error: ORA-20001: User xyxlll does not have acccess to the gva BA_DEV
ORA-06512: at "M_UTIL", line 51 ORA-06512: at line 1. /nTable XY_XY does not exist
(Oracle extract data failed)
17 data null;
18 i ="&qccomment";
19 put i;
20 run;
/n ORACLE execute error: ORA-20001: User xyxlll does not have acccess to the gva BA_DEV
ORA-06512: at "M_UTIL", line 51 ORA-06512: at line 1. /nTable XY_XY does not exist
(Oracle extract data failed)
NOTE: The data set WORK.NULL has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.08 seconds
cpu time 0.00 seconds