Henderson 1015 1102
List input has several restrictions on the type of data that it can read:
• Input values must be separated by at least one blank (the default delimiter) or by the
delimiter specified with the DLM= or DLMSTR= option in the INFILE statement. If
you want SAS to read consecutive delimiters as if there is a missing value between
them, specify the DSD option in the INFILE statement.
• Blanks cannot represent missing values. A real value, such as a period, must be used
• To read and store a character input value longer than 8 bytes, define a variable's
length by using a LENGTH, INFORMAT, or ATTRIB statement before the INPUT
statement, or by using modified list input, which consists of an informat and the
colon modifier in the INPUT statement. See “Modified List Input” on page 446 for
• Character values cannot contain embedded blanks when the file is delimited by
• Fields must be read in order.
• Data must be in standard numeric or character format.
Note: Nonstandard numeric values, such as packed decimal data, must use the formatted
style of input. See “Formatted Input” on page 448 for more information.
Modified List Input
A more flexible version of list input, called modified list input, includes format
modifiers. The following format modifiers enable you to use list input to read
nonstandard data by using SAS informats:
• The & (ampersand) format modifier enables you to read character values that contain
one or more embedded blanks with list input and to specify a character informat.
SAS reads until it encounters two consecutive blanks, the defined length of the
variable, or the end of the input line, whichever comes first.
• The : (colon) format modifier enables you to use list input but also to specify an
informat after a variable name, whether character or numeric. SAS reads until it
encounters a blank column, the defined length of the variable (character only), or the
end of the data line, whichever comes first.
• The ~ (tilde) format modifier enables you to read and retain single quotation marks,
double quotation marks, and delimiters within character values.
The following is an example of the : and ~ format modifiers. You must use the DSD
option in the INFILE statement. Otherwise, the INPUT statement ignores the ~ format
infile datalines dsd;
input Name : $9. Score1-Score3 Team ~ $25. Div $;
Smith,12,22,46,"Green Hornets, Atlanta",AAA
Mitchel,23,19,25,"High Volts, Portland",AAA
Jones,09,17,54,"Vulcans, Las Vegas",AA
446 Chapter 21 • Reading Raw Data