DATA Step Statements by Category

In addition to being either executable or declarative, SAS DATA step statements can be grouped into five functional categories:
Categories of DATA Step Statements
Statements Category
Functionality
Action
  • 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
Control
  • skip statements for certain observations
  • change the order that statements are executed
  • transfer control from one part of a program to another
File-handling
  • work with files used as input to the data set
  • work with files to be written by the DATA step
Information
  • give SAS additional information about the program data vector
  • give SAS additional information about the data set or data sets that are being created.
Window Display
  • display and customize windows.
The following table lists and briefly describes the DATA step statements by category.
Category Language Elements Description
ActionABORT StatementStops executing the current DATA step, SAS job, or SAS session.
Assignment StatementEvaluates an expression and stores the result in a variable.
CALL StatementInvokes a SAS CALL routine.
DELETE StatementStops processing the current observation.
DESCRIBE StatementRetrieves source code from a stored compiled DATA step program or a DATA step view.
ERROR StatementSets _ERROR_ to 1. A message written to the SAS log is optional.
EXECUTE StatementExecutes a stored compiled DATA step program.
IF Statement, SubsettingContinues processing only those observations that meet the condition of the specified expression.
LIST StatementWrites to the SAS log the input data record for the observation that is being processed.
LOSTCARD StatementResynchronizes the input data when SAS encounters a missing or invalid record in data that has multiple records per observation.
Null StatementSignals the end of data lines or acts as a placeholder.
OUTPUT StatementWrites the current observation to a SAS data set.
PUTLOG StatementWrites a message to the SAS log.
REDIRECT StatementPoints to different input or output SAS data sets when you execute a stored program.
REMOVE StatementDeletes an observation from a SAS data set.
REPLACE StatementReplaces an observation in the same location.
STOP StatementStops execution of the current DATA step.
Sum StatementAdds the result of an expression to an accumulator variable.
WHERE StatementSelects observations from SAS data sets that meet a particular condition.
ControlCONTINUE StatementStops processing the current DO-loop iteration and resumes processing the next iteration.
DO StatementSpecifies a group of statements to be executed as a unit.
DO Statement, IterativeExecutes statements between the DO and END statements repetitively, based on the value of an index variable.
DO UNTIL StatementExecutes statements in a DO loop repetitively until a condition is true.
DO WHILE StatementExecutes statements in a DO-loop repetitively while a condition is true.
END StatementEnds a DO group or SELECT group processing.
GO TO StatementDirects 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 StatementExecutes a SAS statement for observations that meet specific conditions.
label: StatementIdentifies a statement that is referred to by another statement.
LEAVE StatementStops processing the current loop and resumes with the next statement in the sequence.
LINK StatementDirects 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 StatementStops executing statements at the current point in the DATA step and returns to a predetermined point in the step.
SELECT StatementExecutes one of several statements or groups of statements.
Data AccessCATNAME StatementLogically 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 StatementAssociates 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 MethodEnables you to reference a SAS catalog as an external file.
FILENAME, CLIPBOARD Access MethodEnables you to read text data from and write text data to the clipboard on the host computer.
FILENAME Statement, EMAIL (SMTP) Access MethodEnables you to send electronic mail programmatically from SAS using the SMTP (Simple Mail Transfer Protocol) e-mail interface.
FILENAME Statement, FTP Access MethodEnables you to access remote files by using the FTP protocol.
FILENAME Statement, Hadoop Access MethodEnables you to access files on a Hadoop Distributed File System (HDFS) whose location is specified in a configuration file.
FILENAME Statement, SFTP Access MethodEnables you to access remote files by using the SFTP protocol.
FILENAME Statement, SOCKET Access MethodEnables you to read from or write to a TCP/IP socket.
FILENAME Statement, URL Access MethodEnables you to access remote files by using the URL access method.
FILENAME Statement, WebDAV Access MethodEnables you to access remote files by using the WebDAV protocol.
LIBNAME StatementAssociates 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 EngineAssociates a libref with a JMP data table and enables you to read and write JMP data tables.
LIBNAME Statement for WebDAV Server AccessAssociates a libref with a SAS library and enables access to a WebDAV (Web-based Distributed Authoring And Versioning) server.
File-handlingBY StatementControls the operation of a SET, MERGE, MODIFY, or UPDATE statement in the DATA step and sets up special grouping variables.
CARDS StatementSpecifies that data lines follow.
CARDS4 StatementSpecifies that data lines that contain semicolons follow.
DATA StatementBegins a DATA step and provides names for any output SAS data sets, views, or programs.
DATALINES StatementSpecifies that data lines follow.
DATALINES4 StatementIndicates that data lines that contain semicolons follow.
FILE StatementSpecifies the current output file for PUT statements.
INFILE StatementSpecifies an external file to read with an INPUT statement.
INPUT StatementDescribes the arrangement of values in the input data record and assigns input values to the corresponding SAS variables.
INPUT Statement, ColumnReads input values from specified columns and assigns them to the corresponding SAS variables.
INPUT Statement, FormattedReads input values with specified informats and assigns them to the corresponding SAS variables.
INPUT Statement, ListScans the input data record for input values and assigns them to the corresponding SAS variables.
INPUT Statement, NamedReads data values that appear after a variable name that is followed by an equal sign and assigns them to corresponding SAS variables.
MERGE StatementJoins observations from two or more SAS data sets into a single observation.
MODIFY StatementReplaces, deletes, and appends observations in an existing SAS data set in place but does not create an additional copy.
PUT StatementWrites 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, ColumnWrites variable values in the specified columns in the output line.
PUT Statement, FormattedWrites variable values with the specified format in the output line.
PUT Statement, ListWrites variable values and the specified character strings in the output line.
PUT Statement, NamedWrites variable values after the variable name and an equal sign.
SET StatementReads an observation from one or more SAS data sets.
UPDATE StatementUpdates a master file by applying transactions.
InformationARRAY StatementDefines the elements of an array.
Array Reference StatementDescribes the elements in an array to be processed.
ATTRIB StatementAssociates a format, informat, label, and length with one or more variables.
DROP StatementExcludes variables from output SAS data sets.
FORMAT StatementAssociates formats with variables.
INFORMAT StatementAssociates informats with variables.
KEEP StatementSpecifies the variables to include in output SAS data sets.
LABEL StatementAssigns descriptive labels to variables.
LENGTH StatementSpecifies the number of bytes for storing variables.
MISSING StatementAssigns characters in your input data to represent special missing values for numeric data.
RENAME StatementSpecifies new names for variables in output SAS data sets.
RETAIN StatementCauses 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 ControlComment StatementSpecifies the purpose of the statement or program.
PAGE StatementSkips to a new page in the SAS log.
RESETLINE StatementRestarts the program line numbers in the SAS log to 1.
SKIP StatementCreates a blank line in the SAS log.
Operating EnvironmentX StatementIssues an operating-environment command from within a SAS session.
Output ControlFOOTNOTE StatementWrites up to 10 lines of text at the bottom of the procedure or DATA step output.
TITLE StatementSpecifies title lines for SAS output.
Program ControlCHECKPOINT EXECUTE_ALWAYS StatementIndicates to execute the DATA step or PROC step that immediately follows without considering the checkpoint-restart data.
DM StatementSubmits SAS Program Editor, Log, Procedure Output or text editor commands as SAS statements.
ENDSAS StatementTerminates a SAS job or session after the current DATA or PROC step executes.
%INCLUDE StatementBrings a SAS programming statement, data lines, or both, into a current SAS program.
%LIST StatementDisplays lines that are entered in the current session.
LOCK StatementAcquires and releases an exclusive lock on an existing SAS file.
OPTIONS StatementSpecifies or changes the value of one or more SAS system options.
RUN StatementExecutes the previously entered SAS statements.
%RUN StatementEnds source statements following a %INCLUDE * statement.
SASFILE StatementOpens a SAS data set and allocates enough buffers to hold the entire file in memory.
SYSECHO StatementFires a global statement complete event and passes a text string back to the IOM client.
Window DisplayDISPLAY StatementDisplays a window that is created with the WINDOW statement.
WINDOW StatementCreates customized windows for your applications.