|
楼主

楼主 |
发表于 2011-11-9 13:21:57
|
只看该作者
请帮忙指点一下code,看这个macro问题在哪里?
在写个MACRO: %macro aa(name=, time=);. . .;%mend;
在这个macro里,首先要检查name是不是正确(所有name存在data class里),如果name出错,要求在SAS log里给出提示;
还有,要检查time的format是不是date9.,如果不是,要求在SAS log里给出提示.
我是这样写的,但发现有问题,请高手指教.
%macro aa(name=, time=);
proc sql noprint;select distinct name into :names separated by ' ' from class;quit;
%if %upcase(&name.) not in %upcase(&names.) %then %do;
%put error: &name. is invalid.;
%end;
%if %sysfunc(vformat(&time.))^='DATE9.' %then %do;
%put error: &time. format is invalid;
%end;
. . .
%mend;
%aa(name=Abc,time=01/01/2011)
请高手指点一下错在何处,如何改正?
谢谢!!! |
|