Prerequisites
You should understand the concepts that are presented in the following sections:
Chapter 3, “Introduction to DATA Step Processing,” on page 27
Chapter 4, “Starting with Raw Data: The Basics,” on page 51
Chapter 7, “Understanding DATA Step Processing,” on page 107
Chapter 23, “Analyzing Your SAS Session with the SAS Log,” on page 365
Understanding How the SAS Supervisor Checks a
Job
To better understand the errors that you make so that you can avoid them in the future, it
is important to understand how the SAS Supervisor checks a job. The SAS Supervisor is
the part of SAS that is responsible for executing SAS programs. To check the syntax of a
SAS program, the SAS Supervisor does the following:
reads the SAS statements and data
translates the program statements into executable machine code or intermediate code
creates data sets
calls SAS procedures, as requested
writes error messages
ends the job
The SAS Supervisor knows the following information about DATA and PROC steps:
the forms and types of statements that can be present in a DATA step
the types of statements and the options that can be present in a PROC step
To process a program, the SAS Supervisor scans all the SAS statements and breaks each
statement into words. Each word is processed separately. When all the words in a step
are processed, the step is executed. If the SAS Supervisor detects an error, then it flags
the error at its location and writes an explanation in the log. The SAS Supervisor
assumes that anything that it does not recognize is an error.
Understanding How SAS Processes Errors
When SAS detects an error, it usually underlines the error in the log or underlines the
point at which it detects the error, identifying the error with a number. Each number is
uniquely associated with an error message. Then SAS enters syntax check mode, and
reads the remaining program statements, checks their syntax, and underlines additional
errors if necessary.
In a batch or noninteractive program, an error in a DATA step statement causes SAS to
remain in syntax check mode for the rest of the program. It does not execute any more
DATA or PROC steps that create external files or SAS data sets. Procedures that are read
from SAS data sets execute with 0 observations, and procedures that do not read SAS
400 Chapter 25 Diagnosing and Avoiding Errors

Get Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd 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.