Previous Page | Next Page

Starting with Raw Data: The Basics

Review of SAS Tools


Statements

DATALINES;

indicates that data lines immediately follow the DATALINES statement. A semicolon in the line that immediately follows the last data line indicates the end of the data and causes the DATA step to compile and execute.

INFILE DATALINES DLM='character';

identifies the source of the input records as data lines in the job stream rather than as an external file. When your program contains the input data, the data lines directly follow the DATALINES statement. Because you can specify DATALINES in the INFILE statement, you can take advantage of many data-reading options that are available only through the INFILE statement.

The DLM= option specifies the character that is used to separate data values in the input records. By default, a blank space denotes the end of a data value. This option is useful when you want to use list input to read data records in which a character other than a blank separates data values.

INPUT variable <&> <$>;

reads the input data record using list input. The & (ampersand format modifier) enables character values to contain embedded blanks. When you use the ampersand format modifier, two blanks are required to signal the end of a data value. The $ indicates a character variable.

INPUT variable start-column <- end-column>;

reads the input data record using column input. You can omit end-column if the data is only 1 byte long. This style of input enables you to skip columns of data that you want to omit.

INPUT variable : informat;
INPUT variable & informat;

read the input data record using modified list input. The : (colon format modifier) instructs SAS to use the informat that follows to read the data value. The & (ampersand format modifier) instructs SAS to use the informat that follows to read the data value. When you use the ampersand format modifier, two blanks are required to signal the end of a data value.

INPUT <pointer-control> variable informat;

reads raw data using formatted input. The informat supplies special instructions to read the data. You can also use a pointer-control to direct SAS to start reading at a particular column.

The syntax given above for the three styles of input shows only one variable. Subsequent variables in the INPUT statement may or may not be described in the same input style as the first one. You may use any of the three styles of input (list, column, and formatted) in a single INPUT statement.


Column-Pointer Controls

@n

moves the pointer to the nth column in the input buffer.

+n

moves the pointer forward n columns in the input buffer.

/

moves the pointer to the next line in the input buffer.

#n

moves the pointer to the nth line in the input buffer.

Previous Page | Next Page | Top of Page