The DLM= option If you read your data using list input, the DATA step expects your file
to have spaces between your data values. The DELIMITER=, or DLM=, option in the INFILE
statement allows you to read data files with other delimiters. The comma and tab characters are
common delimiters found in data files, but you could read data files with any delimiter character
by just enclosing the delimiter character in quotation marks after the DLM= option (i.e.,
DLM=’&’).
Example The following file is comma-delimited where students’ names are followed by the
number of books they read for each week in a summer reading program:
Grace,3,1,5,2,6
Martin,1,2,4,1,3
Scott,9,10,4,8,6
This program uses list input to read the books data file specifying the comma as the delimiter:
DATA reading;
INFILE ’c:\MyRawData\Books.dat’ DLM = ’,’;
INPUT Name $ Week1 Week2 Week3 Week4 Week5;
RUN;
If the same data had tab characters between values instead of commas, then you could use the
following program to read the file. This program uses the DLM=’09’X option. In ASCII, 09 is the
hexadecimal equivalent of a tab character, and the notation ‘09’X means a hexadecimal 09. If
your computer uses EBCDIC (IBM mainframes) instead of ASCII, then use DLM=’05’X.
DATA reading;
INFILE ’c:\MyRawData\Books.txt’ DLM = ’09’X;
INPUT Name $ Week1 Week2 Week3 Week4 Week5;
RUN;
By default, SAS interprets two or more delimiters in a row as a single delimiter. If your file has
missing values, and two delimiters in a row indicate a missing value, then you will also need the
DSD option in the INFILE statement.