Statements |
Valid: | in a DATA step |
Category: | Action |
Type: | Executable |
See: | ABORT Statement under Windows UNIX OpenVMS z/OS |
Syntax | |
Without Arguments | |
Arguments | |
Details | |
Comparisons | |
Examples | |
See Also |
Syntax |
ABORT <ABEND | CANCEL <FILE> | RETURN | > <n> <NOLIST>; |
Without Arguments |
If you specify no argument, the ABORT statement produces these results under the following methods of operation:
stops processing the current 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 statement.
continues limited processing of the remainder of the SAS job, including executing macro statements, executing system options statements, and syntax checking of program statements.
creates output data sets for subsequent DATA and PROC steps with no observations.
stops processing the current DATA step. Any further DATA steps or procedures execute normally.
Arguments |
causes abnormal termination of the current SAS job or session. Results depend on the method of operation:
causes the execution of the submitted statements to be canceled. Results depend on the method of operation:
batch mode and noninteractive mode
the entire SAS program and SAS system are terminated
an error message is written to the SAS log
windowing environment and interactive line mode
clears only the current submitted program
other subsequent submitted programs are not affected
an error message is written to the SAS log
workspace server and stored process server
clears only the currently submitted program
other subsequent submit calls are not affected
an error message is written to the SAS log
SAS IntrNet application server
creates a separate execution for each request and submits the request code. A CANCEL argument 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.
Warning: | When the 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 the immediate normal termination of the current SAS job or session. Results depend on the method of operation:
is 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 not used with the CANCEL argument, SAS returns the value to the operating environment when the execution stops. The range of values for n depends on your operating environment.
suppresses the output of all variables to the SAS log.
Requirement: | NOLIST must be the last option in the ABORT statement. |
Details |
The ABORT statement causes SAS to stop processing the current DATA step. What happens next depends on
The ABORT statement usually appears in a clause of an IF-THEN statement or a SELECT statement that is designed to stop processing when an error condition occurs.
Note: The return code generated by the ABORT statement is ignored by SAS if the system option ERRORABEND is in effect.
Note: When you execute an ABORT 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.
Operating Environment Information: The only difference between the ABEND and RETURN options is that with ABEND further action is based on how your operating environment and site treat jobs that end abnormally. RETURN simply returns a condition code that indicates an error.
Comparisons |
When you use the SAS windowing environment or interactive line mode, the ABORT statement and the STOP statement both stop processing. The ABORT statement sets the value of the automatic variable _ERROR_ to 1, and the STOP statement does not.
In batch or noninteractive mode, the ABORT and STOP statements also have different effects. Both stop processing, but only ABORT sets the value of the automatic variable _ERROR_ to 1. Use the STOP statement, therefore, when you want to stop only the current DATA step and continue processing with the next step.
Examples |
This example uses the ABORT statement as part of an IF-THEN statement to stop execution of SAS when it encounters a data value that would otherwise cause a division-by-zero condition.
if volume=0 then abort 255; density=mass/volume;
The n value causes SAS to return the condition code 255 to the operating environment when the ABORT statement executes.
See Also |
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.