Yes I have a similar sort of text file
text file 1:
001DATA...
002DATA...
RSSDATA...
001DATA...
002DATA...
text file 2:
001DATA...
002DATA...
001DATA...
002DATA...
Here as per the data if I dont find the value of a variable to be RSS then dont need to read the text file.
One way to code such a test is to take advantage of the CANCEL option on the RUN statement. So first create an empty macro variable and then while reading the first file conditionally set the macro variable to contain the keyword CANCEL. Then reference the macro variable in the second data step that reads the second data file.
%let run_cancel=;
data _null_;
infile 'file1' ;
input;
if _infile_=: 'RSS' then do;
call symputx('run_cancel','cancel');
stop;
end;
run;
data want ;
infile 'file2' ;
input ....... ;
run &run_cancel ;
yup this is what I was looking for tom. thanks a lot ...
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.