As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
The ABORT statement is used to terminate processing the current DATA Step and, optionally, cause SAS to generate an error. What happens after the DATA step is terminated will depend on the statement arguments that are used.
- ABORT < ABEND | CANCEL <FILE> | RETURN > < n > < NOLIST >;
- ABORT ;
Causes the DATA step to terminate and SAS to enter syntax check mode and continue processing the rest of the file.
- ABORT ABEND ;
Causes the DATA step to terminate immediately, and not process the file any further, with an error condition when returning control to the operating system with an abnormal termination code.
- ABORT CANCEL ;
Causes the entire SAS program to terminate. May also terminate the SAS system in batch or non-interactive modes.
FILE optional argument
- ABORT CANCEL FILE ;
Only valid in autoexecute or %INCLUDEd files. Causes execution of the file to be canceled.
- ABORT RETURN ;
Causes the DATA step to terminate immediately, and not process the file any further, without causing an error condition when control is returned to the operating system.
Error number (n) argument
- ABORT ... n ;
The value of n is an integer which is returned as a condition code (or error code) for the step.
- ABORT ... NOLIST ;
Suppresses listing variables in the SAS log. The NOLIST keyword must be the last argument in the statement.
The ABORT statement is best used in situations where an error situation is encountered that would result in SAS producing undesirable results if processing were allowed to continue. For example, it may be better to abort processing than process missing values because SAS encounters invalid data in a calculation, such as it is going to divide by zero.
The ABORT statement ends a DATA step and causes and error. If all that is desired is to stop processing the DATA step then it may be better to use the STOP statement instead.