SAS从另一个程序内部的宏调用一个程序

时间:2019-07-05 18:39:18

标签: sas

我有2个sas程序,我试图从程序2中的宏调用程序1。程序1使用了我在程序2中设置的宏变量。 但我得到:macro variable not resolved error

test1.sas:

data test_&year1.;
a=1;
run;

test2.sas:
%macro x1(&year1);
...other code..;
%include test1.sas
%mend;

%x1(2019);

1 个答案:

答案 0 :(得分:3)

摆脱&in%macro语句

%macro x1(year1);

enter image description here

filename FT15F001 temp;
parmcards4;
data test_&year1.;
   a=1;
   run;
;;;;

%macro x1(year1);
   %put NOTE: &=year1;
   %include FT15F001 / source2;
%mend;

%x1(2019);