In addition to being either executable or declarative, SAS DATA step statements can be grouped into these functional categories:
|
Statements Category |
Functionality |
|
|---|---|---|
|
Action |
See Action for a list of statements. |
|
|
CAS |
See CAS for a list of statements. |
|
|
Control |
See Control for a list of statements. |
|
|
File-Handling |
See File-Handling for a list of statements. |
|
|
Information |
See Information for a list of statements. |
|
|
Window Display |
See Window Display for a list of statements. |
|
Some statements run in SAS only, and some statements run in SAS and on the CAS server. If CAS is specified for the statement category, then the statement runs in SAS and on the CAS server. If CAS is not specified for the statement category, then the statement runs in SAS only. For example, the DO statement runs in SAS and on the CAS server, so CAS is specified as a category. The ABORT statement runs in SAS only, so CAS is not specified as a category.
This 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. | |
| 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. | |
| CAS | ARRAY Statement | Defines the elements of an array. |
| Array Reference Statement | Describes the elements in an array to be processed. | |
| Assignment Statement | Evaluates an expression and stores the result in a variable. | |
| ATTRIB Statement | Associates a format, informat, label, and length with one or more variables. | |
| BY Statement | Controls the operation of a SET, MERGE, MODIFY, or UPDATE statement in the DATA step and sets up special grouping variables. | |
| CALL Statement | Invokes a SAS CALL routine. | |
| CONTINUE Statement | Stops processing the current DO-loop iteration and resumes processing the next iteration. | |
| DATA Statement | Begins a DATA step and provides names for any output such as SAS data sets, views, or programs. | |
| DELETE Statement | Stops processing the current observation. | |
| 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. | |
| DROP Statement | Excludes variables from output SAS data sets. | |
| END Statement | Ends DO group or SELECT group processing. | |
| ERROR Statement | Sets _ERROR_ to 1. A message written to the SAS log is optional. | |
| FILE Statement | Specifies the current output file for PUT statements. | |
| FORMAT Statement | Associates formats with variables. | |
| GOTO 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 Statement: Subsetting | Continues processing only those observations that meet the condition of the specified expression. | |
| IF-THEN/ELSE Statement | Executes a SAS statement for observations that meet specific conditions. | |
| 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. | |
| 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. | |
| LENGTH Statement | Specifies the number of bytes for storing character and numeric variables, or the number of characters for storing VARCHAR variables. | |
| 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. | |
| 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. | |
| MERGE Statement | Joins observations from two or more SAS data sets into a single observation. | |
| OUTPUT Statement | Writes the current observation to a SAS data set. | |
| 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. | |
| PUTLOG Statement | Writes a message to the SAS log. | |
| 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. | |
| 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. | |
| SET Statement | Reads an observation from one or more SAS data sets. | |
| 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 DO group or SELECT group processing. | |
| GOTO 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. | |
| 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 lines of data follow the statement. | |
| CARDS4 Statement | Specifies that the lines of data that follow the statement contain internal semicolons. | |
| DATA Statement | Begins a DATA step and provides names for any output such as SAS data sets, views, or programs. | |
| DATALINES Statement | Specifies that lines of data follow the statement. | |
| DATALINES4 Statement | Specifies that the lines of data that follow the statement contain internal semicolons. | |
| 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 the values 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 the values 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 character and numeric variables, or the number of characters for storing VARCHAR variables. | |
| 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. | |
| Window Display | DISPLAY Statement | Displays a window that is created with the WINDOW statement. |
| WINDOW Statement | Creates customized windows for your applications. |