Chapter 8
Error Processing and Debugging
Types of Errors in SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Summary of Types of Errors That SAS Recognizes . . . . . . . . . . . . . . . . . . . . . . . 135
Syntax Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Semantic Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Execution-Time Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Data Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Macro-related Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Error Processing in SAS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Syntax Check Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Processing Multiple Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Checkpoint Mode and Restart Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Using System Options to Control Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . 151
Using Return Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Other Error-Checking Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Debugging Logic Errors in the DATA Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Types of Errors in SAS
Summary of Types of Errors That SAS Recognizes
SAS performs error processing during both the compilation and the execution phases of
SAS processing. You can debug SAS programs by understanding processing messages in
the SAS log and then fixing your code. You can use the DATA Step Debugger to detect
logic errors in a DATA step during execution.
SAS recognizes five types of errors.
Table 8.1 Types of Errors
Type of Error When This Error Occurs
When the Error Is
Detected
syntax when programming statements do
not conform to the rules of the
SAS language
compile time
135

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.