You can read multiple text files with identical structure in one data step into one dataset. By using the FILENAME= option in the INFILE statement, you can keep the name of the originating textfile in a variable in the dataset:
data want;
length filename fname $200;
infile "path/name*.txt" filename=fname /* other options */;
input .....;
filename = fname;
run;
The second variable (filename) is necessary because fname will be made temporary and cannot be kept in the output dataset.
Later on, you can use the filename variable to make output in a data step that writes text files dynamic.
... View more