unnamed pipe,批次獲取某資料夾下內的特定檔名,然後再批次做後續操作,如:
filename indata pipe "dir d:\sas\xml /b";
length fname $20.;
infile indata truncover;
input fname $20.;
call symput ("nvars",_n_);
run;
%macro want;
%do i=1 %to &nvars.;
data _null_;
if _n_=&i;
call symput ("file",fname);
data tmp;
infile "d:\sas\xml\&file." firstobs=2;
input x y z;
proc datasets;
append base=want data=tmp;
quit;
%end;
%mend;
%want
unnamed pipe,批次獲取某資料夾下內的特定檔名,然後再批次做後續操作,如:
filename indata pipe "dir d:\sas\xml /b";
length fname $20.;
infile indata truncover;
input fname $20.;
call symput ("nvars",_n_);
run;
%macro want;
%do i=1 %to &nvars.;
data _null_;
if _n_=&i;
call symput ("file",fname);
run;
data tmp;
infile "d:\sas\xml\&file." firstobs=2;
input x y z;
run;
proc datasets;
append base=want data=tmp;
quit;
%end;
%mend;
%want