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: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 468 views
  • 0 likes
  • 2 in conversation