The DATA Step

What Does the DATA Step Do?

The DATA step processes input data. In a DATA step, you can create a SAS data set, which can be a SAS data file or a SAS view. The DATA step uses input from raw data, remote access, assignment statements, or SAS data sets. DATA step can compute values, select specific input records for processing, and use conditional logic. The output from the DATA step can be of several types, such as a SAS data set or a report. You can also write data to the SAS log or to an external data file. For more information, see DATA Step Processing.

DATA Step Output

The output from the DATA step can be a SAS data set or an external file such as the program log, a report, or an external data file. You can also update an existing file in place, without creating a separate data set. Data must be in the form of a SAS data set to be processed by many SAS procedures. You can create the following types of DATA step output:
SAS log
contains a list of processing messages and program errors. The SAS log is produced by default.
SAS data file
is a SAS data set that contains two parts: a data portion and a data descriptor portion.
SAS view
is a SAS data set that uses descriptor information and data from other files. SAS views enable you to dynamically combine data from various sources without using disk space to create a new data set. While a SAS data file actually contains data values, SAS views contain only references to data stored elsewhere. SAS views are of member type VIEW. In most cases, you can use a SAS view as if it were a SAS data file.
External data file
contains the results of DATA step processing. These files are data or text files. The data can be records that are formatted or free-formatted.
Report
contains the results of DATA step processing. Although you usually generate a report by using a PROC step, you can generate the following two types of reports from the DATA step:
Procedure output file contains printed results of DATA step processing, and usually contains headers and page breaks.
HTML file contains results that you can display on the World Wide Web. This type of output is generated through the Output Delivery System (ODS).