|Syntax Check Mode|
- reads the remaining statements in the DATA step
- checks that statements are valid SAS statements
- executes global statements
- identifies any other errors that it finds
- creates the descriptor portion of any output data sets that are specified in program statements
- does not write any observations to new data sets that SAS creates
- does not execute most of the subsequent DATA steps or procedures in the program (exceptions include PROC DATASETS and PROC CONTENTS).
|How Different Modes Process Errors|
When you run SAS in interactive line mode or in a windowing environment, syntax check mode is in effect only during the step where SAS encountered the error. When the system detects an error, it stops executing the current step and continues processing the next step.
|Processing Multiple Errors|
The following example illustrates a statement with two errors:
data temporary; Item1=4; run; proc print data=temporary; var Item1 Item2 Item3; run;SAS Log: Multiple Program Errors
cpu time 0.00 seconds 1 data temporary; 2 Item1=4; 3 run; NOTE: The data set WORK.TEMPORARY has 1 observations and 1 variables. NOTE: DATA statement used: real time 0.10 seconds cpu time 0.01 seconds 4 5 proc print data=temporary; ERROR: Variable ITEM2 not found. ERROR: Variable ITEM3 not found. 6 var Item1 Item2 Item3; 7 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE PRINT used: real time 0.53 seconds cpu time 0.01 seconds
When running debugged production programs that are unlikely to encounter errors, you may want to force SAS to abend after a single error occurs. You can use the ERRORABEND system option to do this.
|Using System Options to Debug a Program|
|BYERR||controls whether SAS generates an error message and sets the error flag when a _NULL_ data set is used in the SORT procedure.|
|DKRICOND=||controls the level of error detection for input data sets during the processing of DROP=, KEEP=, and RENAME= data set options.|
|DKROCOND=||controls the level of error detection for output data sets during the processing of DROP=, KEEP=, and RENAME= data set options and the corresponding DATA step statements.|
|DSNFERR||controls how SAS responds when a SAS data set is not found.|
|ERRORABEND||specifies how SAS responds to errors.|
|ERRORCHECK=||controls error handling in batch processing.|
|ERRORS=||controls the maximum number of observations for which complete error messages are printed.|
|FMTERR||determines whether SAS generates an error message when a format of a variable cannot be found.|
|INVALIDDATA=||specifies the value that SAS assigns to a variable when invalid numeric data is encountered.|
|MERROR||controls whether SAS issues a warning message when a macro-like name does not match a macro keyword.|
|SERROR||controls whether SAS issues a warning message when a defined macro variable reference does not match a macro variable.|
|VNFERR||controls how SAS responds when a _NULL_ data set is used.|
|Using Return Codes|
Operating Environment Information: For more information about return codes, see the SAS documentation for your operating environment.
|Other Error Checking Options|
- the _IORC_ automatic variable that SAS creates (and the associated IORCMSG function) when you use the MODIFY statement or the KEY= data set option in the SET statement
- the ERROR= system option to limit the number of identical errors that SAS writes to the log
- the SYSRC and SYSMSG functions to return information when a data set or external file access function encounters an error condition
- the SYSRC and SYSERR macro variables
- log control options:
MSGLEVEL= controls the level of detail in messages that are written to the SAS log. PRINTMSGLIST controls the printing of extended lists of messages to the SAS log. SOURCE controls whether SAS writes source statements to the SAS log. SOURCE2 controls whether SAS writes source statements included by %INCLUDE to the SAS log.