如何在数据步骤中使用 SAS 宏
我正在运行一个与以下一个相似的代码,数据步骤不起作用,我似乎不明白为什么
%macro macro_1(variable);
rsubmit;
data want_&variable. (keep = a b c);
set have;
run;
endrsubmit;
%mend macro_1;
%macro testing;
%do i=1 %to 3;
%macro_1(&i.); /* My loop here*/
%end;
%mend testing;
%testing;
这是我一直遇到的错误:
语法错误,期望以下一个:一个名称,引用的字符串字符串,(,(/,;, data , last , null
。多
感谢您的帮助!
I'm running a code similare to the following one and the data step is not working and I can't seem to understand why
%macro macro_1(variable);
rsubmit;
data want_&variable. (keep = a b c);
set have;
run;
endrsubmit;
%mend macro_1;
%macro testing;
%do i=1 %to 3;
%macro_1(&i.); /* My loop here*/
%end;
%mend testing;
%testing;
Here's the error I keep on getting :
Syntax error, expecting one of the following: a name, a quoted string, (, /, ;, DATA, LAST, NULL.
I have tried using the double ampersand or using more periods at the end, unsuccessfully however
Much thanks for any help !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已在本地计算机上定义了宏变量 VARIABLE,但使用该宏变量的代码正在远程计算机上运行。在尝试使用该值之前,请尝试将该值推送到远程计算机。
You have defined the macro variable VARIABLE on the local machine, but the code that is using the macro variable is running on the remote machine. Try pushing the value to the remote machine before trying to use it.