As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


DATA Step statement

From sasCommunity
Jump to: navigation, search

A DATA Step statement is a statement that can be used in a DATA Step.

Some SAS statements have restrictions on them and can only be used in certain contexts, or in a particular order. Their use at other times may cause an error or unexpected program behaviour. Many SAS statements are restricted to just the DATA step portions of SAS code.

Statements that start a DATA Step

Statements that can only be used in a DATA Step

The statements in the following list can only be used in a DATA step.

Declarative statements

These statements declare attributes relating to variables and datasets.


Executable statements

Calculations

  • Array Reference statement;
  • Assignment statement;
  • Sum statement;

Data handling

Stored Processes

Merging data sources

  • MERGE statement;
  • MODIFY statement;
  • REMOVE statement;
  • REPLACE statement;
  • UPDATE statement;

Window control

Conditional execution

Statements that can only be used with a DO Group in a DATA Step

The statements in this list can be used with or in a DO group inside a DATA step.

Statements that introduce inline data records

  • DATALINES statement; (alias CARD;, LINES;) - This statement must be the last statement in the DATA step before any lines of data. The lines of data are terminated by a null statement consisting of a single semicolon(;) after the last line of data. The data must not contain a semicolon.
  • DATALINES4 statement; (alias CARD4;, LINES4;) - This statement must be the last statement in the DATA step before any lines of data. The lines of data are terminated by a null statement consisting of a null statement of 4 semicolons (;;;;) at the start of a new line. The data can contain semicolons.

Statements that affect DATA Step iterations or statement execution order

The statements in this list affect DATA Step processing, either starting a new iteration or terminating the iteration process.

Statements that can be used in a DATA Step or PROC Step

The statements in this list can be used in a DATA step or a PROC step.

Statements that can be used anywhere, including DATA Steps

The statements in this list are able to be used in a DATA step, but are not restricted to just DATA steps and can be used anywhere.

Other statements that can be used in a DATA step

The statements in this list can be used in a DATA step but may be more effective if they are used beforehand.

DATA Step boundary statements

Certain statements mark the end of a data step and result in the DATA step being processed and executed.

See Usage Note 40887: Definition of step boundaries and the difference between a RUN statement and a QUIT statement