請重試。此代碼不起作用。這是一個愚蠢的代碼,但仍然不起作用。SAS宏變量將無法解析
data work.colnames;
input cols $;
cards;
U1
B1
;
run;
data work.test;
input rp_U1 $ rp_B1 $;
cards;
col1 col2
;
run;
%macro maketest;
proc sql;
select cols
into :col separated by " "
from colnames;
quit;
%do i=1 %to 2;
%let c = %qscan(&col,&i);
%put rp_&c;
proc sql;
create table test&i as
select
rp_&c
from work.test;
quit;
%end;
%mend;
%maketest;
我得到這個錯誤:
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, '.', /, <, <=, <>, =, >, >=, ?, AND, AS,
CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.
,我覺得奇怪的是,如果我試圖讓列沒有這個代碼的作品找到rp_。也改變
select
rp_&c
到
select
&c
打開MPRINT('選項MPRINT;')和日誌重視的問題。我們能夠更輕鬆地幫助您調試問題。 – DomPazz