BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Imroze
Fluorite | Level 6

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.

 

Tom
Super User Tom
Super User

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 ;
Imroze
Fluorite | Level 6

yup this is what I was looking for tom. thanks a lot ...

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 4324 views
  • 2 likes
  • 5 in conversation