DATA Step, Macro, Functions and more

how can i terminate a sas job with sas code

Reply
N/A
Posts: 0

how can i terminate a sas job with sas code

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;
Respected Advisor
Posts: 3,908

Re: how can i terminate a sas job with sas code

Look up:
- abort
- %abort
- endsas
- stop
SAS Super FREQ
Posts: 8,745

Re: how can i terminate a sas job with sas code

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
Ask a Question
Discussion stats
  • 2 replies
  • 146 views
  • 0 likes
  • 3 in conversation