如何使用基本的SAS宏阵列?
初学者问题:我正在尝试使用 SAS 宏数组,如本文所述:http://www2.sas.com/proceedings/sugi31/040-31.pdf,特别是 %ARRAY WITH DATA= AND VAR=
部分。不幸的是,没有使用此功能的完整程序的示例,并且我在网上找不到任何简单的示例。我尝试创建一个简单的示例,猜测一些事情,但没有成功。 (每个宏都有两个错误:“宏 ARRAY 的明显调用未解决。”和“语句无效或未按正确顺序使用。”)我做错了什么?
这是代码:(
data data1;
input variable1;
datalines;
1
2
3
4
run;
%array(array1, data=data1, var=variable1);
%do_over(array1, phrase=PROC PRINT DATA=data1(obs=?));
run;
另外,有人知道 SAS 网站的名称吗?我记得见过它,但我找不到了。)
谢谢!
Beginner question: I am trying to use SAS macro arrays as explained in this article: http://www2.sas.com/proceedings/sugi31/040-31.pdf, specifically in the section %ARRAY WITH DATA= AND VAR=
. Unfortunately there are no examples of a full program using this, and I can't find any simple examples online. I tried to create a simple example, guessing at some things, but it didn't work. (I got two errors for each macro: "Apparent invocation of macro ARRAY not resolved." and "Statement is not valid or it is used out of proper order.") What am I doing wrong?
Here is the code:
data data1;
input variable1;
datalines;
1
2
3
4
run;
%array(array1, data=data1, var=variable1);
%do_over(array1, phrase=PROC PRINT DATA=data1(obs=?));
run;
(Also, does anyone know the name of the SAS website which is sort of like this one? I remember seeing it but I can't find it again.)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 SAS 社区网站下载包含宏的 zip 文件: http://www.sascommunity.org/ wiki/Tight_Looping_with_Macro_Arrays
将它们包含在您的 SAS 程序中,它应该可以工作。
You can download a zip file with the macros at the SAS Community website: http://www.sascommunity.org/wiki/Tight_Looping_with_Macro_Arrays
Include them in your SAS program and it should work.