SAS Language Element Function
HEADER= option in the FILE statement alters the flow of control whenever a PUT
statement causes a new page of output to begin;
statements following the label specified in the
HEADER= option are executed until a RETURN
statement is encountered, at which time control
returns to the point from which the HEADER=
option was activated.
GO TO statement alters the flow of execution by branching to the
label that is specified in the GO TO statement. SAS
executes subsequent statements then returns control
to the beginning of the DATA step.
EOF= option in an INFILE statement alters the flow of execution when the end of the
input file is reached; statements following the label
that is specified in the EOF= option are executed at
that time.
_N_ automatic variable in an IF-THEN
construct
causes parts of the DATA step to execute only for
particular iterations.
SELECT statement conditionally executes one of a group of SAS
statements.
OUTPUT statement in an IF-THEN
construct
outputs an observation before the end of the DATA
step, based on a condition; prevents automatic
output at the bottom of the DATA step.
DELETE statement in an IF-THEN
construct
deletes an observation based on a condition and
causes a return to the top of the DATA step.
ABORT statement in an IF-THEN
construct
stops execution of the DATA step and instruct SAS
to resume execution with the next DATA or PROC
step. It can also stop executing a SAS program
altogether, depending on the options specified in
the ABORT statement and on the method of
operation.
WHERE statement or WHERE= data set
option
causes SAS to read certain observations based on
one or more specified criteria.
Step Boundary—How to Know When Statements Take Effect
Understanding step boundaries is an important concept in SAS programming because
step boundaries determine when SAS statements take effect. SAS executes program
statements only when SAS crosses a default or a step boundary. Consider the following
DATA steps:
data _null_; 1
set allscores(drop=score5-score7);
title 'Student Test Scores'; 2
412 Chapter 18 • DATA Step Processing