BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10

Hello Folks,

 

not taking into account that the former is a macro statement while the later is a data step statement, I was wondering whether there is any difference in the sense of behaviour/performance between:

%ABORT ABEND;

and

data _NULL_;
  abort;
run;

I found in the documentation of the two statements

 

https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=p0f7j2zr6z71nqn1fpefnmulzazf.htm&docse...

 

and

 

https://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=p0hp2evpgqvfsfn1u223hh9ubv3g.htm&doc...

 

that both times it is stated that

 

"What happens next depends on

  • the method that you use to submit your SAS statements
  • the arguments that you use with %ABORT
  • your operating environment"

Or can they be used interchangeably?

 

Cheers,

FK1

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

I also agree with @s_lassen  that they do the same thing.

 

I've found the most useful form is ABORT CANCEL (or %ABORT CANCEL) which stops the current step and cancels all downstream processing.

 

I have a little macro called Abort_Pgm that I use when I am in open code but don't want to write a DATA step:

%MACRO Abort_Pgm;
  %ABORT CANCEL;
%MEND Abort_Pgm;

I have found that macro useful.

 

Jim

View solution in original post

3 REPLIES 3
s_lassen
Meteorite | Level 14

AFAIK, %ABORT and the ABORT statement in a data step do the same.

 

So this

data _null_;
  abort;
run;

is equivalent to this

%abort;

And this

%abort abend;

does exactly the same as

data _null_;
  abort abend;
run;
jimbarbour
Meteorite | Level 14

I also agree with @s_lassen  that they do the same thing.

 

I've found the most useful form is ABORT CANCEL (or %ABORT CANCEL) which stops the current step and cancels all downstream processing.

 

I have a little macro called Abort_Pgm that I use when I am in open code but don't want to write a DATA step:

%MACRO Abort_Pgm;
  %ABORT CANCEL;
%MEND Abort_Pgm;

I have found that macro useful.

 

Jim

FK1
Lapis Lazuli | Level 10 FK1
Lapis Lazuli | Level 10
Thx,Jim for your explanation

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
  • 3 replies
  • 2511 views
  • 4 likes
  • 3 in conversation