SAS中文论坛

标题: a Gobal vs. Local Symbol Table question.. [打印本页]

作者: shiyiming    时间: 2011-3-10 08:30
标题: a Gobal vs. Local Symbol Table question..
This is from one of the questions discussed. But I am still a bit confused:

%macro loop1 (input);
        %put date1 is &DATE;
        %loop2;
        %put date2 is &DATE;
%mend;

%macro loop2;
        data _NULL_;
                call symput('DATE', '28SEP1998');
                %put date3 is &DATE;
        run;
%mend;

%let DATE=31DEC2006;
%put date4 is &DATE;

%loop1(&DATE)
%put date5 is &DATE;


Here is the output:
date1 is 31DEC2006
date2 is 28SEP1998
date3 is 31DEC2006
date4 is 31DEC2006
date5 is 28SEP1998

I dont get why date3 and date5 are 31DEC2006 and 28SEP1998. Any helps, please??

Thanks!
作者: shiyiming    时间: 2011-3-10 14:57
标题: Re: a Gobal vs. Local Symbol Table question..
<!-- m --><a class="postlink" href="http://saslist.com/hssnow/2011/02/09/sas-macro-symbol-table-1/">http://saslist.com/hssnow/2011/02/09/sa ... l-table-1/</a><!-- m -->
作者: shiyiming    时间: 2011-3-11 05:10
标题: Re: a Gobal vs. Local Symbol Table question..
This is very detailed and helpful! Thanks!

(I learned not only the difference, but their Chinese translation!)




欢迎光临 SAS中文论坛 (http://mysas.net/forum/) Powered by Discuz! X3.2