SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

12
返回列表 发新帖
楼主: shiyiming
打印 上一主题 下一主题

ask a question about symput()

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
11#
 楼主| 发表于 2012-7-15 21:55:41 | 只看该作者

Re: ask a question about symput()

集思广益!!!
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
12#
 楼主| 发表于 2012-7-18 01:59:34 | 只看该作者

Re: ask a question about symput()

you may use symget to do it.
%macro a;
data b;set a;
x=symget("t"||compress(put(_n_,3.)));
run;
%mend;
%a
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
13#
 楼主| 发表于 2012-7-19 05:34:10 | 只看该作者

Re: ask a question about symput()

good try.
there are many ways to copy sales to x as I said before, but I am just curious what is wrong with my code(As you can see, it looks good and reasonable).
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
14#
 楼主| 发表于 2012-7-19 21:08:01 | 只看该作者

Re: ask a question about symput()

After macro compiling, the program processing should be that the following codes were executed sequentially:
data b; set a; nn =1;x =36;output;run;
data b; set a; nn =2;x =58;output;run;

data b; set a; nn =5;x =27;output;run;
After being continuously overwritten, the set b in the last round is the final one: nothing more than assigning number to both variables of nn and x.
you could see it more clearly by changing data b; >>>data;
jingju
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-5-6 09:53 , Processed in 0.070303 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表