Statement

From sasCommunity
Jump to: navigation, search
This is a work in progress. You can contribute to this article.

In the SAS programming language, a statement provides SAS with information and instructions. Each statement can contain keywords, names of variables, constants, symbols and other tokens separate by white-space and is ended by a semicolon.

Statements are read and executed in the order that they are written, from left to right, top to bottom, and can be compressed into a single line or indented and spread out across multiple lines to make them more readable.

Statement labels, which identify particular statements, and are used to indicate program flow, may precede a statement.

Statements are usually classified by the initial keyword, which describes the action the statement performs, or information it provides. Some statements are valid only in certain contexts or have different meanings in different contexts. Some statements do not have an introductory keyword, while others may consist of only a keyword, without arguments.

Generic Syntax

(optional label:) KEYWORD (optional arguments) ;

Statements

See Index (Statements) for more information.
Null statement 
has no keyword and consists of only a semicolon (;) It can be used after any other statement or after a label. It is also used to end a group of datalines. Four semicolons in a row (;;;;), that starting on a new line, are needed to end a group of datalines that were introduced by the DATALINES4 statement. Other than that additional semicolons between statements are null statements that convey no additional meanings to SAS.

Macro statements

See Macro statements for more information.

Macro statements have a keyword that commences with a percent (%) symbol.

Further Reading