Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我运行下面的 sas 代码时,它不会生成表。我究竟做错了什么?谢谢。
%macro createData(test=); %if 2+2 = 4 %then %do; proc sql; create table test as select * from datasets.mydata ; quit; %end; %mend;
只要您实际调用宏,该代码就可以正常运行!
你还需要一行:
%createData(test=1);
(test=1是任意的,因为你没有对&test宏参数做任何事情,我只是选择了我想要的任何东西)。
test=1
&test
SAS 宏在其他编程语言中与方法类似——它们在被调用之前不做任何事情,运行宏定义本身只是编译宏并准备好使用。