I have input file, in which the first line has header information. (Data values which are tab-separated). Amongst these values, there is an integer value that specifies how the rest of the file should be parsed. If this value is less than a threshold value, then the file should be parsed in one way, otherwise if the value is greater that the threshold value, then the data should be parsed in a different way.
%let isNew = Undefined;
data header;
infile "&infile" OBS=1;
INPUT Agency $ Status $ Num $ fdate sdate;
if fdate < 20130428 then
%let isNew = false;
else
%let isNew = true;
run;
data factors;
infile "&infile" missover FIRSTOBS=2 LRECL=1000;
if isNew = false then
input
@1 poolno $6.
@7 factor 9.8 @;
else
input
@3 poolno $6.
@9 factor 9.8 @;
(some more input parsing code)
In the above code, I have defined a variable isNew and setting that variable to true/false depending on the condition check. In the subsequent data block, I am using the value of this variable to decide which way the file is to be parsed.
A sample input file is (the value to be examined is in bold):
FHLMC UPDATE #1 20130130 20130306
138788024201321000
140379000000000000
I am new to SAS. Any suggestions please?