实际上,SAS在调用%eval函数之前执行变量替换最简单的解决方案是在之前的语句中调用%eval
%let xNr = %eval(&it+1); %put "&&x_&xNr";
双&符号用于延迟评估x_&xNr
直到&xNr
评估到2
并且没有x_
未定义的警告.
SYMBOLGEN: Macro variable IT resolves to 1 SYMBOLGEN: && resolves to &. SYMBOLGEN: Macro variable XNR resolves to 2 SYMBOLGEN: Macro variable X_2 resolves to 99 " 99"