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;
reads 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 might be described in the same input style as the first
one. You can 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.
Learning More
Advanced features
For some more advanced data-reading features, see Chapter 5, “Starting with Raw
Data: Beyond the Basics,” on page 71.
Character-delimited data
For more information about reading data that is delimited by a character other than a
blank space, see the DELIMITER= option in “INFILE Statement” in SAS
Statements: Reference.
Learning More 69
Pointer controls
For a complete discussion and listing of column-pointer controls, line-pointer
controls, and line-hold specifiers, see SAS Statements: Reference.
Types of input
For more information about the INPUT statement, see “INPUT Statement” in SAS
Statements: Reference.
70 Chapter 4 Starting with Raw Data: The Basics

Get Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.