BookmarkSubscribeRSS Feed
Taliah
Obsidian | Level 7

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.

 

 

2 REPLIES 2
ballardw
Super User

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.

 

Taliah
Obsidian | Level 7

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. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 504 views
  • 0 likes
  • 2 in conversation