Chapter 18: Reading and Creating Raw Data in Free-Format
Correct answer: b
The raw data file contains
data that is free-format, meaning that the data is not arranged in
columns or fixed fields.
Correct answer: c
List input should be
used to read data that is free-format because you do not need to specify
the column locations of the data.
Correct answer: c
You can use the DSD
option in the FILE statement to specify that data values containing
commas should be enclosed in quotation marks. The DSD option uses
a comma as the delimiter by default.
Correct answer: a
Because the data is
free-format, list input is used to read the values. With list input,
you simply name each variable and identify its type.
Correct answer: d
The INFILE statement
identifies the location of the external data file. The DLM= option
specifies the colon (:) as the delimiter that separates each field.
Correct answer: a
You can use the MISSOVER
option in the INFILE statement to read the missing values at the end
of a record. The MISSOVER option prevents SAS from moving to the next
record if values are missing in the current record.
Correct answer: b
The LENGTH statement
extends the length of the character variable LastName so that it is
large enough to accommodate the data. Variable attributes such as
length are defined the first time a variable is named in a DATA step.
The LENGTH statement should precede the INPUT statement so that the
correct length is defined.
Correct answer: d
Notice that the values
for School contain embedded blanks, and the values for Enrolled are
nonstandard numeric values. Modified list input can be used to read
the values that contain embedded blanks and nonstandard values.
Correct answer: b
The INPUT statement
uses list input with format modifiers and informats to read the values
for each variable. The ampersand (&) modifier enables you to read
character values that contain single embedded blanks. The colon (:)
modifier enables you to read nonstandard data values and character
values that are longer than eight characters, but which contain no
embedded blanks.
Correct answer: d
The values for Year
can be read with column, formatted, or list input. However, the values
for School and Enrolled are free-format data that contain embedded
blanks or nonstandard values. Therefore, these last two variables
must be read with modified list input.