You should be able to read all of the files at once into a single dataset.
Here is the header from the example file you posted.
Experiment Readings
1/1/17 0:00
AB+BC1-0
Acq Mode Absorbance
A 65
B 4
C 3
D 3100
Efg 0
average 5.882
Hij 0.363
Klm 0.272
Nop -0.227
WANT1 Dar Ref Smp Tx WANT2 R
300 955.6786 1349.0714 1122.6786 41.2929 0.3841 0.3841
300.37 950.8929 1352.2142 1124.7142 42.1942 0.3747 0.3747
300.74 946.8929 1352.75 1131.3928 44.3959 0.3527 0.3527
301.11 949.1429 1356.4642 1132.4642 43.9383 0.3572 0.3572
Looks like the first line is a constant text, the second has the runtime and the third has the description.
So we should be able to read all of the files in one data step and just look for that header line to know when a new one starts.
If your file is really using CR only as the end of file marker then update the TERMSTR= option on the INFILE statement.
%let path=your directory name here;
data want ;
infile "&path/*.dat" dsd dlm='09'x truncover termstr=CRLF;
input @;
if _infile_=:'Experiment Readings' then do;
input / rundate :anydtdtm32. / runname :$32. /////////////// ;
end;
retain rundate runname ;
format rundate datetime20.;
input WANT1 Dar Ref Smp Tx WANT2 R;
run;
... View more