I'm still not sure exactly where the similarities are I will assume all file types have the same record structure. Therefore all type 1 files can be read with one data step. This example creates data(files) and reads them, into one data set.
Let me know your questions. All infile and file options are documented. And PIPE example are found in "Companion" and at support.sas.com
[pre]
dm 'clear log; clear output;';
* create test data(files to be read in next step);
data _null_;
length command $256;
infile cards truncover;
input name :$128.;
if _n_ eq 1 then do;
path = quote(substr(name,1,find(name,'\',-length(name))));
command = 'rmdir /S /Q ".\xUsers\"';
infile dummy1 pipe filevar=command;
command = catx(' ','mkdir',path);
put command=;
infile dummy1 pipe filevar=command;
rc = sleep(1); *small delay;
end;
file dummy filevar=name dsd dlm=',';
do _n_ = 1 to 10;
put _n_:z5. name;
end;
cards;
.\xUsers\mherrin\Documents\trial\APX05132005.1
.\xUsers\mherrin\Documents\trial\APX05132005.2
.\xUsers\mherrin\Documents\trial\APX0513.DRF
.\xUsers\mherrin\Documents\trial\APX05142005.1
.\xUsers\mherrin\Documents\trial\APX05142005.2
.\xUsers\mherrin\Documents\trial\APX0514.DRF
.\xUsers\mherrin\Documents\trial\PEN05142005.1
.\xUsers\mherrin\Documents\trial\PEN05142005.2
.\xUsers\mherrin\Documents\trial\PEN0514.DRF
;;;;
run;
*** Read all the type .1 records;
data Type1;
length command filename fname path $256.;
command = 'dir /s /b ".\xUsers"';
infile dummy1 pipe filevar=command truncover;
input path $256.;
if scan(path,-1,'.') eq '1';
put _infile_;
infile dummy2 filevar=path filename=fname end=eof dsd;
filename = scan(fname,-2,'.\');
length prefix $3;
prefix = filename; * assumes prefix is always first 3 chars;
date = input(substr(filename,anydigit(filename)),mmddyy10.);
do while(not eof);
input obs name:$64.; ** Fields for type 1 files?;
output;
end;
format date date9.;
run;
proc print;
run;
[/pre]