A SAS statement is a series of items that may include keywords, SAS names , special characters , and operators. All SAS statements end with a semicolon. A SAS statement either requests SAS to perform an operation or gives information to the system.
This section covers two kinds of SAS statements:
those that are used in DATA step programming
those that are global in scope and can be used anywhere in a SAS program.
Base SAS Procedures Guide gives detailed descriptions of the SAS statements that are specific to each SAS procedure. The Complete Guide to the SAS Output Delivery System gives detailed descriptions of the Output Delivery System (ODS) statements.
DATA step statements are executable or declarative statements that can appear in the DATA step. Executable statements result in some action during individual iterations of the DATA step; declarative statements supply information to SAS and take effect when the system compiles program statements.
The following tables show the SAS executable and declarative statements that you can use in the DATA step.
Executable Statements | ||
---|---|---|
ABORT | IF, Subsetting | PUT |
assignment | IF-THEN/ELSE | PUT, Column |
CALL | INFILE | PUT, Formatted |
CONTINUE | INPUT | PUT, List |
DECLARE | INPUT, Column | PUT, Named |
DELETE | INPUT, Formatted | PUT, _ODS_ |
DESCRIBE | INPUT, List | PUTLOG |
DISPLAY | INPUT, Named | REDIRECT |
DO | LEAVE | REMOVE |
DO, Iterative | LINK | REPLACE |
DO Until | LIST | RETURN |
DO While | LOSTCARD | SELECT |
ERROR | MERGE | SET |
EXECUTE | MODIFY | STOP |
FILE | _NEW_ | Sum |
FILE, ODS | Null | UPDATE |
GO TO | OUTPUT |
Declarative Statements | ||
---|---|---|
ARRAY | DATALINES | LABEL |
Array Reference | DATALINES4 | Labels, Statement |
ATTRIB | DROP | LENGTH |
BY | END | RENAME |
CARDS | FORMAT | RETAIN |
CARDS4 | INFORMAT | WHERE |
DATA | KEEP | WINDOW |
Global statements generally provide information to SAS, request information or data, move between different modes of execution, or set values for system options. Other global statements (ODS statements) deliver output in a variety of formats, such as in Hypertext Markup Language (HTML). You can use global statements anywhere in a SAS program. Global statements are not executable; they take effect as soon as SAS compiles program statements.
Other SAS software products have additional global statements that are used with those products. For information, see the SAS documentation for those products.