BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5

%macro test1;
data ex1 ;
set sashelp.class;
where sex='F'
run;
%mend ;

%macro test2;
data ex2 ;
set sashelp.class;
where sex='M' ;
run;
%mend ;

%test1;
%test2;

 

I wrote two macro applications If i run the 2 macro applications don't run second application because there is one syntax error in the

first macro application.

Note: If any error in the step don't run the next step

4 REPLIES 4
thanikondharish
Calcite | Level 5
Not only syntax error if anytype of error comes in first step don't run
second step
Kurt_Bremser
Super User

Since 9.4M5, you can use

%if
%then %do;
.......
%end;

in open code. Use the automatic variable &syscc to determine the current error (return code) status of your SAS session. Hint: you can reset &syscc yourself:

%let syscc=0;

 

Tom
Super User Tom
Super User

How are you running your program?

If you are just submitting the program from the command line then try just setting the ERRORABEND option and SAS will stop on the first error.

 

Note this doesn't work well if you are using some type of interactive process to run your SAs code.  Such as Enterprise Guide or SAS/Studio of SAS Display Manager.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 956 views
  • 0 likes
  • 4 in conversation