In addition to being
either executable or declarative, SAS DATA step statements can be
grouped into five functional categories:
Categories of DATA Step Statements
|
|
|
-
create and modify variables
-
select only certain observations
to process in the DATA step
-
look for errors in the input data
-
work with observations as they
are being created
|
|
-
skip statements for certain observations
-
change the order that statements
are executed
-
transfer control from one part
of a program to another
|
|
-
work with files used as input to
the data set
-
work with files to be written by
the DATA step
|
|
-
give SAS additional information
about the program data vector
-
give SAS additional information
about the data set or data sets that are being created.
|
|
-
display and customize windows.
|
The following table
lists and briefly describes the DATA step statements by category.
Category |
Language Elements |
Description |
Action | ABORT Statement | Stops executing
the current DATA step, SAS job,
or SAS session. |
Assignment Statement | Evaluates an expression and stores the
result in
a variable. |
CALL Statement | Invokes a SAS CALL routine. |
DELETE Statement | Stops processing the current observation. |
DESCRIBE Statement | Retrieves source code from a stored compiled
DATA
step program or a DATA step view. |
ERROR Statement | Sets _ERROR_ to 1. A message written to the
SAS
log is optional. |
EXECUTE Statement | Executes a stored compiled DATA step program. |
IF Statement, Subsetting | Continues processing only those observations
that
meet the condition of the specified expression. |
LIST Statement | Writes to the SAS log the input data record
for
the observation that is being processed. |
LOSTCARD Statement | Resynchronizes the input data when SAS encounters
a missing or invalid record in data that has multiple records per
observation. |
Null Statement | Signals the end of data lines or acts as a placeholder. |
OUTPUT Statement | Writes the current observation to a SAS data
set. |
PUTLOG Statement | Writes a message to the SAS log. |
REDIRECT Statement | Points to different input or output SAS
data sets
when you execute a stored program. |
REMOVE Statement | Deletes an observation from a SAS data set. |
REPLACE Statement | Replaces an observation in the same location. |
STOP Statement | Stops execution of the current DATA step. |
Sum Statement | Adds the result of an expression to an accumulator
variable. |
WHERE Statement | Selects observations from SAS data sets that
meet
a particular condition. |
Control | CONTINUE Statement | Stops processing
the current DO-loop iteration and
resumes processing the next iteration. |
DO Statement | Specifies a group of statements to be executed
as
a unit. |
DO Statement, Iterative | Executes statements between the DO
and END statements
repetitively, based on the value of an index variable. |
DO UNTIL Statement | Executes statements in a DO loop repetitively
until
a condition is true. |
DO WHILE Statement | Executes statements in a DO-loop repetitively
while
a condition is true. |
END Statement | Ends a DO group or SELECT group processing. |
GO TO Statement | Directs program execution immediately to the
statement
label that is specified and, if followed by a RETURN statement, returns
execution to the beginning of the DATA step. |
IF-THEN/ELSE Statement | Executes a SAS statement for observations
that meet
specific conditions. |
label: Statement | Identifies a statement that is referred to
by another
statement. |
LEAVE Statement | Stops processing the current loop and resumes
with
the next statement in the sequence. |
LINK Statement | Directs program execution immediately to the
statement
label that is specified and, if followed by a RETURN statement, returns
execution to the statement that follows the LINK statement. |
RETURN Statement | Stops executing statements at the current
point
in the DATA step and returns to a predetermined point in the step. |
SELECT Statement | Executes one of several statements or groups
of
statements. |
Data Access | CATNAME Statement | Logically
combines two or more catalogs into one
by associating them with a catref (a shortcut name); clears one or
all catrefs; lists the concatenated catalogs in one concatenation
or in all concatenations. |
FILENAME Statement | Associates a SAS fileref with an external
file or
an output device, disassociates a fileref and external file, or lists
attributes of external files. |
FILENAME Statement, CATALOG Access Method | Enables you to reference
a SAS catalog as an external
file. |
FILENAME, CLIPBOARD Access Method | Enables you to read text
data from and write text
data to the clipboard on the host computer. |
FILENAME Statement, EMAIL (SMTP) Access Method | Enables you
to send electronic mail programmatically
from SAS using the SMTP (Simple Mail Transfer Protocol) e-mail interface. |
FILENAME Statement, FTP Access Method | Enables you to access
remote files by using the
FTP protocol. |
FILENAME Statement, Hadoop Access Method | Enables you to access
files on a Hadoop Distributed
File System (HDFS) whose location is specified in a configuration
file. |
FILENAME Statement, SFTP Access Method | Enables you to access
remote files by using the
SFTP protocol. |
FILENAME Statement, SOCKET Access Method | Enables you to read
from or write to a TCP/IP socket. |
FILENAME Statement, URL Access Method | Enables you to access
remote files by using the
URL access method. |
FILENAME Statement, WebDAV Access Method | Enables you to access
remote files by using the
WebDAV protocol. |
LIBNAME Statement | Associates or disassociates a SAS library
with a
libref (a shortcut name), clears one or all librefs, lists the characteristics
of a SAS library, concatenates SAS libraries, or concatenates SAS
catalogs. |
LIBNAME Statement for the JMP Engine | Associates a libref with
a JMP data table and enables
you to read and write JMP data tables. |
LIBNAME Statement for WebDAV Server Access | Associates a libref
with a SAS library and enables
access to a WebDAV (Web-based Distributed Authoring And Versioning)
server. |
File-handling | BY Statement | Controls the
operation of a SET, MERGE, MODIFY,
or UPDATE statement in the DATA step and sets up special grouping
variables. |
CARDS Statement | Specifies that data lines follow. |
CARDS4 Statement | Specifies that data lines that contain semicolons
follow. |
DATA Statement | Begins a DATA step and provides names for any
output
SAS data sets, views, or programs. |
DATALINES Statement | Specifies that data lines follow. |
DATALINES4 Statement | Indicates that data lines that contain
semicolons
follow. |
FILE Statement | Specifies the current output file for PUT statements. |
INFILE Statement | Specifies an external file to read with an
INPUT
statement. |
INPUT Statement | Describes the arrangement of values in the
input
data record and assigns input values to the corresponding SAS variables. |
INPUT Statement, Column | Reads input values from specified columns
and assigns
them to the corresponding SAS variables. |
INPUT Statement, Formatted | Reads input values with specified
informats and
assigns them to the corresponding SAS variables. |
INPUT Statement, List | Scans the input data record for input
values and
assigns them to the corresponding SAS variables. |
INPUT Statement, Named | Reads data values that appear after
a variable name
that is followed by an equal sign and assigns them to corresponding
SAS variables. |
MERGE Statement | Joins observations from two or more SAS data
sets
into a single observation. |
MODIFY Statement | Replaces, deletes, and appends observations
in an
existing SAS data set in place but does not create an additional copy. |
PUT Statement | Writes lines to the SAS log, to the SAS output
window,
or to an external location that is specified in the most recent FILE
statement. |
PUT Statement, Column | Writes variable values in the specified
columns
in the output line. |
PUT Statement, Formatted | Writes variable values with the specified
format
in the output line. |
PUT Statement, List | Writes variable values and the specified
character
strings in the output line. |
PUT Statement, Named | Writes variable values after the variable
name and
an equal sign. |
SET Statement | Reads an observation from one or more SAS data
sets. |
UPDATE Statement | Updates a master file by applying transactions. |
Information | ARRAY Statement | Defines the
elements of an array. |
Array Reference Statement | Describes the elements in an array
to be processed. |
ATTRIB Statement | Associates a format, informat, label, and
length
with one or more variables. |
DROP Statement | Excludes variables from output SAS data sets. |
FORMAT Statement | Associates formats with variables. |
INFORMAT Statement | Associates informats with variables. |
KEEP Statement | Specifies the variables to include in output
SAS
data sets. |
LABEL Statement | Assigns descriptive labels to variables. |
LENGTH Statement | Specifies the number of bytes for storing
variables. |
MISSING Statement | Assigns characters in your input data to
represent
special missing values for numeric data. |
RENAME Statement | Specifies new names for variables in output
SAS
data sets. |
RETAIN Statement | Causes a variable that is created by an INPUT
or
assignment statement to retain its value from one iteration of the
DATA step to the next. |
Log Control | Comment Statement | Specifies
the purpose of the statement or program. |
PAGE Statement | Skips to a new page in the SAS log. |
RESETLINE Statement | Restarts the program line numbers in the
SAS log
to 1. |
SKIP Statement | Creates a blank line in the SAS log. |
Operating Environment | X Statement | Issues an operating-environment
command from within
a SAS session. |
Output Control | FOOTNOTE Statement | Writes
up to 10 lines of text at the bottom of the
procedure or DATA step output. |
TITLE Statement | Specifies title lines for SAS output. |
Program Control | CHECKPOINT EXECUTE_ALWAYS Statement | Indicates
to execute the DATA step or PROC step
that immediately follows without considering the checkpoint-restart
data. |
DM Statement | Submits SAS Program Editor, Log, Procedure Output
or text editor commands as SAS statements. |
ENDSAS Statement | Terminates a SAS job or session after the
current
DATA or PROC step executes. |
%INCLUDE Statement | Brings a SAS programming statement, data
lines,
or both, into a current SAS program. |
%LIST Statement | Displays lines that are entered in the current
session. |
LOCK Statement | Acquires and releases an exclusive lock on an
existing
SAS file. |
OPTIONS Statement | Specifies or changes the value of one or
more SAS
system options. |
RUN Statement | Executes the previously entered SAS statements. |
%RUN Statement | Ends source statements following a %INCLUDE
* statement. |
SASFILE Statement | Opens a SAS data set and allocates enough
buffers
to hold the entire file in memory. |
SYSECHO Statement | Fires a global statement complete event and
passes
a text string back to the IOM client. |
Window Display | DISPLAY Statement | Displays
a window that is created with the WINDOW
statement. |
WINDOW Statement | Creates customized windows for your applications. |