全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1370 7
2013-05-21
%macro one(input);
  %two
  %put the value is &date;
%mend;

     %macro two;
          data _null_;
          call symput (
'date','12SEP2008');
          run;
     %mend;
%let date=31DEC2006;
%one(&date);

&date 为什么是'12SEP2008' 来自global 而不是local symbol table one啊?请高手指教,多谢了。

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-5-21 20:17:36
觉得程序写的很乱,但是大概猜得到你的问题,我把help里面的原话复制下来
CALL SYMPUT creates the macro variable in the current symbol table available while the DATA step is executing, provided that symbol table is not empty. If it is empty (contains no local macro variables), usually CALL SYMPUT creates the variable in the closest nonempty symbol table.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-21 21:38:58
geniusv 发表于 2013-5-21 20:17
觉得程序写的很乱,但是大概猜得到你的问题,我把help里面的原话复制下来
CALL SYMPUT creates the macro  ...
这个我也看到了,sually CALL SYMPUT creates the variable in the closest nonempty symbol table
这个例子里data two 是空的 最近的非空table不应该是one么?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-21 21:57:28
先在one里找,没有,再在two里找,找到了12SEP2008,如果还没找到,就在globle symbol table里找,找到31DEC2006。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-21 22:02:35
boe 发表于 2013-5-21 21:57
先在one里找,没有,再在two里找,找到了12SEP2008,如果还没找到,就在globle symbol table里找,找到31DE ...
这不对吧,先在two里找吧,没有在one里找,再没有在global里面找
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-5-21 22:39:49
clark3721 发表于 2013-5-21 22:02
这不对吧,先在two里找吧,没有在one里找,再没有在global里面找
嗯,前面表述有点问题。基于问题:
options mprint mlogic;
%let date=31DEC2006;
%put &date;
%one(&date.)
%put &date;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群