|
沙发

楼主 |
发表于 2011-5-5 12:57:42
|
只看该作者
Re: 如何用macro来自动生成文件命
[code:21h1g9wf]data a;
input sc $ pt map;
cards;
a 1 62
b 3 9
b 2 7
c 1 12
;
proc sql noprint;
create table _temp as select distinct sc from a;
select cats('ds_',sc) into :dslist separated by ' ' from _temp;
quit;
data _null_;
set _temp end=last;
if _n_=1 then call execute("data &dslist; set a;");
call execute(cat('if sc=',quote(trim(sc)),' then output ds_',trim(sc),';'));
if last then call execute('run; proc delete data=_temp; run;');
run;[/code:21h1g9wf] |
|