Hello, I have a set of sas programs that run in sequence. The users run them through another program containing -
%incllude "/path/program1.sas"; %incllude "/path/program2.sas"; etc.
In some of the programs I need to be able to stop that program and all following programs from running, based on an if statement (e.g., when a variable is above a certain limit). How can that be done? Thank you.
Is the "value" in a data set or a macro variable? Is the IF going to be in data step code or for macro variables between procedures/data steps?
Are the jobs run interactively or in batch?
The ABORT statement in a data step is conditional (can be run on a value encountered) and has options ABEND (halts SAS), Cancel and Return. Each behaves a bit differently depending on run environment, interactive or batch and possibly if encountered in an %include file. You can also set a condition code.
Thank you. The value is a macro variable. The jobs are run in batch.
"You can also set a condition code." - what do you mean by that?
"Is the IF going to be in data step code or for macro variables between procedures/data steps?" I can set the if statement any way that will work. I compute the value of the macro variable, based on it I will need to stop the programs from running. Now I have that macro variable. I can write an IF statement in a data step, or another way if that will work better.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.