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

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