%macro aaa;
%do i=1 %to 11 %by 0.5;
data _null_;
set t1;
array r(*) _all_;
do j=1 to dim(r);
if &i.<=dim(r) and j<=&i. and j>(&i.-1) then y=(r(j)+r(j+1))/2;
if &i.>dim(r) then do;
%bbb;
y=&yy.;
end;
run;
call symput("y",y);
%put _user_;
%mend aaa;
%aaa;
%macro bbb;
data _null_;
set t1;
array s(*) _all_;
do j=1 to dim(s);
if &i.<=dim(s) and j<=&i. and j>(&i.-1) then yy=(s(j)+s(j+1))/2;
if &i.>dim(s) then yy=0;
call symput("yy",yy);
end;
run;
%mend bbb;作者: shiyiming 时间: 2007-9-30 13:32 标题: Re: 求助!在数据步中调用另外一个宏 貌似宏变量yy是局部的,是不是先定义%global yy;作者: shiyiming 时间: 2007-10-5 21:54 标题: Re: 求助!在数据步中调用另外一个宏 感谢楼上的回复,但是不是问题所在,请各位高手指点一下 <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->作者: shiyiming 时间: 2007-10-6 10:05 标题: Re: 求助!在数据步中调用另外一个宏 你的错误:
NOTE: Line generated by the invoked macro "BBB".
1 data _null_; set t1; array s(*) _all_; do j=1 to dim(s); if &i.<=dim(s) and j<=&i. and
-
117
1 ! j>%eval(&i.-1) then do; yy=(s(j)+s(j+1))/2;end; if &i.>dim(s) then do;yy=0;end; call
1 ! symput("yy",yy); end; run;
[color=#FF0000:38365]ERROR 117-185: There were 2 unclosed DO blocks.[/color:38365]
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE and COLUMN where
the error has occurred.
[color=#FF0000:38365]ERROR 180-322: Statement is not valid or it is used out of proper order.[/color:38365]