Macro Statements |
Type: | Macro statement |
Restriction: | Allowed in macro definitions only |
Syntax | |
Arguments | |
Without Arguments | |
Details |
Syntax |
%ABORT <ABEND | CANCEL <FILE> | RETURN | <n>> ; |
causes abnormal termination of the current macro and SAS job or session. Results depend on the method of operation:
causes the cancellation of the current submitted statements. The results depend on the method of operation:
batch mode and noninteractive mode
The entire SAS program and SAS system are terminated.
The error message is written to the SAS log.
windowing environment and interactive line mode
It only clears the current submitted program.
Other subsequent submitted programs are not affected.
The error message is written to the SAS log.
workspace server and stored process server
It only clears currently submitted program.
Other subsequent submit calls are not affected.
The error message is written to the SAS log.
SAS IntrNet application server
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.
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.
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. |
Restriction: | The CANCEL argument cannot be submitted using SAS/SHARE, SAS/CONNECT, or SAS/AF. |
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.
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.
Without Arguments |
If you specify no argument, the %ABORT macro statement produces these results under the following methods of operation:
batch mode and noninteractive mode
stops processing the current macro and DATA step and writes an error message to the SAS log. Data sets can contain an incomplete number of observations or no observations, depending on when SAS encountered the %ABORT macro statement.
continues limited processing of the remainder of the SAS job, including executing macro statements, executing system option statements, and syntax checking of program statements.
windowing environment
interactive line mode
stops processing the current macro and DATA step. Any further DATA steps or procedures execute normally.
Details |
The %ABORT macro statement causes SAS to stop processing the current macro and DATA step. What happens next depends on
The %ABORT macro statement usually appears in a clause of an %IF-%THEN macro statement that is designed to stop processing when an error condition occurs.
Note: The return code generated by the %ABORT macro statement is ignored by SAS if the system option ERRORABEND is in effect.
Note: When you execute an %ABORT macro statement in a DATA step, SAS does not use data sets that were created in the step to replace existing data sets with the same name.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.