O'Reilly logo

SAS 9.4 Macro Language, 5th Edition by

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dictionary
%ABORT Statement
Stops the macro that is executing along with the current DATA step, SAS job, or SAS session.
Type: Macro statement
Restriction: Allowed in macro definitions only
Syntax
%ABORT <ABEND | CANCEL | <FILE> | RETURN | <n>>;
Required Arguments
ABEND
causes abnormal termination of the current macro and SAS job or session. Results
depend on the method of operation:
batch mode and noninteractive mode.
stops processing immediately.
sends an error message to the SAS log that states that execution was
terminated by the ABEND option of the %ABORT macro statement
does not execute any subsequent statements or check syntax
returns control to the operating environment. Further action is based on how
your operating environment and your site treat jobs that end abnormally.
windowing environment and interactive line mode.
causes your macro, windowing environment, and interactive line mode to
stop processing immediately and return you to your operating environment.
CANCEL <FILE>
causes the cancellation of the current submitted statements. The results depend on
the method of operation.
If the method of operation is batch mode and noninteractive mode, use the CANCEL
option to do the following:
The entire SAS program and SAS system are terminated.
The error message is written to the SAS log.
If the method of operation is windowing environment and interactive line mode, use
the CANCEL option to do the following:
It only clears the current submitted program.
Other subsequent submitted programs are not affected.
The error message is written to the SAS log.
302 Chapter 19 Macro Statements
If the method of operation is workspace server and stored process server, use the
CANCEL option to do the following:
It only clears currently submitted program.
Other subsequent submit calls are not affected.
The error message is written to the SAS log.
If the method of operation is SAS IntrNet application server, use the CANCEL
option to do the following:
A separate execution is created for each request. The execution submits the
request code. A CANCEL in the request code clears the current submitted code
but does not terminate the execution or the SAS session.
FILE
when coded as an option to the CANCEL argument in an autoexec file or in a
%INCLUDE file, causes only the contents of the autoexec file or %INCLUDE
file to be cleared by the %ABORT statement. Other submitted source statements
will be executed after the autoexec or %INCLUDE file.
Restriction
The CANCEL argument cannot be submitted using SAS/SHARE,
SAS/CONNECT, or SAS/AF.
CAUTION
When %ABORT CANCEL FILE option is executed within a
%INCLUDE file, all open macros are closed and execution
resumes at the next source line of code.
RETURN
causes abnormal termination of the current macro and SAS job or session. Results
depend on the method of operation:
batch mode and noninteractive mode
stops processing immediately
sends an error message to the SAS log that states that execution was
terminated by the RETURN option of the %ABORT macro statement
does not execute any subsequent statements or check syntax
returns control to the operating environment with a condition code indicating
an error
windowing environment and interactive line mode
causes your macro, windowing environment, and interactive line mode to
stop processing immediately and return you to your operating environment
n
an integer value that enables you to specify a condition code:
When used with the CANCEL argument, the value is placed in the SYSINFO
automatic macro variable.
When it is NOT used with the CANCEL statement, SAS returns the value to the
operating environment when the execution stops. The range of values for n
depends on your operating environment.
%ABORT Statement 303

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required