statement. The group of language statements contains other programming statements that
manipulate existing SAS data sets or create SAS data sets from raw data files.
You can use the DATA step for the following tasks:
creating SAS data sets (SAS data files or SAS views)
creating SAS data sets from input files that contain raw data (external files)
creating new SAS data sets from existing ones by subsetting, merging, modifying,
and updating existing SAS data sets
analyzing, manipulating, or presenting your data
computing the values for new variables
report writing, or writing files to disk or tape
retrieving information
file management
Note: A DATA step creates a SAS data set. This data set can be a SAS data file or a
SAS view. A SAS data file stores data values while a SAS view stores instructions
for retrieving and processing data. When you can use a SAS view as a SAS data file,
as is true in most cases, this documentation uses the broader term SAS data set.
Overview of DATA Step Processing
Flow of Action
When you submit a DATA step for execution, it is first compiled and then executed. The
following figure shows the flow of action for a typical SAS DATA step.
380 Chapter 18 DATA Step Processing
Figure 18.1 Flow of Action in the DATA Step
data-reading
statement:
is there a
record to read?
reads
an input record
executes
additional
executable statements
writes
an observation to
the SAS data set
returns
to the beginning of
the DATA step
compiles
SAS statements
(includes syntax checking)
creates
an input buffer
a program data vector
descriptor information
begins
with a DATA statement
(counts iterations)
sets
variable values
to missing in the
program data vector
closes
data set;
goes on to the next
DATA or PROC step
NO
YES
Compile Phase
Execution Phase
Overview of DATA Step Processing 381

Get SAS 9.4 Language Reference, 3rd 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.