Characters in the Data What to Use Reason
delimiters, blank characters, or
quoted strings
DSD option, with DLM= or
DLMSTR= option in the
INFILE statement
These options enable SAS
to read a character value
that contains a delimiter
within a quoted string;
these options can also
treat two consecutive
delimiters as a missing
value and remove
quotation marks from
character values.
Remember the following when reading character data:
In a DATA step, when you place a dollar sign ($) after a variable name in the INPUT
statement, character data that is read from data lines remains in its original case. If
you want SAS to read data from data lines as uppercase, use the CAPS system option
or the $UPCASE informat.
If the value is shorter than the length of the variable, SAS adds blanks to the end of
the value to give the value the specified length. This process is known as padding the
value with blanks.
Sources of Raw Data
Instream Data
The following example uses the INPUT statement to read in instream data:
data weight;
input PatientID $ Week1 Week8 Week16;
loss=Week1-Week16;
datalines;
2477 195 177 163
2431 220 213 198
2456 173 166 155
2412 135 125 116
;
Note: A semicolon appearing alone on the line immediately following the last data line
is the convention that is used in this example. However, a PROC statement, DATA
statement, or a global statement ending in a semicolon on the line immediately
following the last data line also submits the previous DATA step.
Instream Data Containing Semicolons
The following example reads in instream data containing semicolons:
data weight;
input PatientID $ Week1 Week8 Week16;
loss=Week1-Week16;
datalines4;
444 Chapter 21 Reading Raw Data

Get SAS 9.4 Language Reference, 6th 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.