You can use wildcards on the INFILE statement. You will also want to use the FILENAME and EOV options on the INFILE statement. Here is a simple example. data _null_; do file='one.txt','two.txt' ; fname=catx('\',pathname('work'),file); file out filevar=fname ; do i=1 to 10; put i; end; end; run; data want ; length fname file $200; infile "%sysfunc(pathname(work))\*.txt" eov=eov filename=fname; input @; if _n_=1 or eov then do; input // i ; file = scan(fname,-1,'\'); output; end; eov=0; run;
... View more