Here is one sample approach using a DO/END to parse through each logical within a physical record:
10 data _null_;
11 infile "c:\temp\parse_data_sas.txt";
12 input ;
13 length tempvar $100;
14 do i=1 to countw(_infile_,';');
15 tempvar = scan(_infile_,i,';');
16 putlog _all_;
17 * add code here to parse each sub-field. ;
18 end;
19 run;
NOTE: The infile "c:\temp\parse_data_sas.txt" is:
Filename=c:\temp\parse_data_sas.txt,
RECFM=V,LRECL=256,File Size (bytes)=43,
Last Modified=09Jun2011:16:35:41,
Create Time=09Jun2011:16:35:41
tempvar=14 x Lgl/D i=1 _ERROR_=0 _INFILE_=14 x Lgl/D; 3 x Ltr; 86 x Ltr/D _N_=1
tempvar=3 x Ltr i=2 _ERROR_=0 _INFILE_=14 x Lgl/D; 3 x Ltr; 86 x Ltr/D _N_=1
tempvar=86 x Ltr/D i=3 _ERROR_=0 _INFILE_=14 x Lgl/D; 3 x Ltr; 86 x Ltr/D _N_=1
tempvar=18 x Lgl/D i=1 _ERROR_=0 _INFILE_=18 x Lgl/D _N_=2
NOTE: 2 records were read from the infile "c:\temp\parse_data_sas.txt".
The minimum record length was 10.
The maximum record length was 31.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
Scott Barry
SBBWorks, Inc.