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 statement

From sasCommunity
Jump to: navigation, search

The DATA statement introduces a new DATA Step by specifying the data set(s) that subsequent DATA Step statements will produce. The DATA statement has a number of alternative variations and a range of options that apply to the output data set can be specified in the statement.

Syntax

The DATA statement comes in several different forms.

DATA Statement - naming data sets

Data sets that are to be created by the data step are named on the DATA statement.

DATA <data set name(s)>;

The following DATA statement will create three data sets:

data animals plants minerals;

DATA statement without arguments

The simplest form of the DATA statement is the DATA statement without arguments. The DATA statement without arguments has the form:

DATA ;

When this form is used the resulting output data set has the name DATAn where n is the smallest (positive) integer that makes the data set name unique.

Null DATA statement

The Null DATA statement is used when a DATA Step is wanted but the output data set is not wanted, because the results of the DATA Step will produce some other effect, such as writing a file, sending an e-mail, writing information to the log or analysing the data set and then saving the result(s) to a macro variable(s). The Null DATA statement has the form:

DATA _NULL_ ;

General form

See DATA statement reference notes for more information

Further reading

See also