BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi, All!

I edit job, there are many steps, in the middle of the job, if some condition arrive, I will terminate the job, do not excute the following steps, such as:

data _null_;
set
format ....
run;
%macro ....
%mend....

%macro-name;

data _null_;
if(condition succeed);
exit(10); /* exit the job, do not execute following code */
run;

%exit(11); /* otherwise exit the job, do not execute following code. */

proc sql;
something deal.........;
run;
quit;
2 REPLIES 2
Patrick
Opal | Level 21
Look up:
- abort
- %abort
- endsas
- stop
Cynthia_sas
Diamond | Level 26
Hi:
In addition to Patrick's suggestions, I suggest you investigate the difference between a DATA step IF statement and a macro program %IF statement. Sometimes when you want to conditionally execute code, and if you are using macro programs, it is easier to test conditions and conditionally send code to the compiler using %IF.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1677 views
  • 0 likes
  • 3 in conversation