楼主: 若水烟寒
7580 16

_all_应该怎么查看和使用? [推广有奖]

11
davil2000 发表于 2012-11-11 16:23:46
若水烟寒 发表于 2012-11-11 16:09
Thank you very much! But I don't understand why I can't use functions like dim() in the macro loop ...
No, u r wrong!  Functions like dim() can be definitely used in the macro loop "%do %to %end", but only inside the data step. Besides, the macro loop "%do %to %end" is not permitted to used inside the data loop, but outside.
R是万能的,SAS是不可战胜的!

12
鼓浪@听涛 发表于 2012-11-11 16:26:54
davil2000 发表于 2012-11-11 16:23
No, u r wrong!  Functions like dim() can be definitely used in the macro loop "%do %to %end", but  ...
really?

钓鱼岛和南沙诸岛都属于中国的!

13
若水烟寒 发表于 2012-11-11 16:33:23
davil2000 发表于 2012-11-11 16:23
No, u r wrong!  Functions like dim() can be definitely used in the macro loop "%do %to %end", but  ...
er...But in the following example, isn't the "%do %to %end" used in the data step "data temp"? It seems it works well in the sas...

data temp;
input x1-x10;
datalines;
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
;
run;
%macro name;
data temp;
set temp;
%do i=1 %to 10;
rename x&i=w&i;
%end;
run;
%mend name;
%name;
proc print data=temp;
run;

14
davil2000 发表于 2012-11-11 16:44:47
若水烟寒 发表于 2012-11-11 16:33
er...But in the following example, isn't the "%do %to %end" used in the data step "data temp"? It  ...
sorry! I have make a mistake in the expression.  The macro loop will disappear  after compilatin.
For example, there exists such a macro
%macro name;
data temp2;
set temp1;
%do i=1 %to 2;
rename x&i=w&i;
%put x&i;
%end;
run;
%mend name;

After compilation , it will  become

data temp2;
set temp1;
rename x1=w1;
rename x2=w2;
run;

已有 2 人评分经验 学术水平 热心指数 信用等级 收起 理由
若水烟寒 + 1 + 1 + 1 观点有启发
大数据之魂 + 100 + 5 + 5 + 5 分析的有道理

总评分: 经验 + 100  学术水平 + 6  热心指数 + 6  信用等级 + 6   查看全部评分

R是万能的,SAS是不可战胜的!

15
davil2000 发表于 2012-11-11 16:47:14
so you can't use functions such as dim() in the macro loop.
R是万能的,SAS是不可战胜的!

16
若水烟寒 发表于 2012-11-11 17:04:15
davil2000 发表于 2012-11-11 16:47
so you can't use functions such as dim() in the macro loop.
Oh, Thank you very much!~~I think I have a long way to go in the sas study....

17
lqyrendajinji 发表于 2012-11-13 04:27:07
thanks thanks thanks

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-1 17:09