Use a variable list
to specify a range of variables as the function argument. When specifying
a variable list, be sure to precede the list with the word of.
If you omit the word of, the
function argument might not be interpreted as expected.
Correct answer: b
When this DATA step
is executed, SAS automatically converts the character values of PayRate
to numeric values so that the calculation can occur. Whenever data
is automatically converted, a message is written to the SAS log stating
that the conversion has occurred.
Correct answer: b
You explicitly convert
character values to numeric values by using the INPUT function. Be
sure to select an informat that can read the form of the values.
Correct answer: d
You explicitly convert
numeric values to character values by using the PUT function. Be sure
to select a format that can read the form of the values.
Correct answer: c
Because the YEARCUTOFF=
system option is set to 1920, SAS sees the two-digit year value 20 as 1920.
Four-digit year values are always read correctly.
Correct answer: a
The SCAN function is
used to extract words from a character value when you know the order
of the words, when their position varies, and when the words are marked
by some delimiter. In this case, you do not need to specify delimiters,
because the blank and the comma are default delimiters.
Correct answer: d
The SUBSTR function
is best used when you know the exact position of the substring to
extract from the character value. You specify the position to start
from and the number of characters to extract.
Correct answer: c
The SUBSTR function
replaces variable values if it is placed on the left side of an assignment
statement. When placed on the right side (as in Question 7), the function
extracts a substring.
Correct answer: b
The TRIM function removes
trailing blanks from character values. In this case, extra blanks
must be removed from the values of FirstName. Although answer c also
works, the extra TRIM function for the variable LastName is unnecessary.
Because of the LENGTH statement, all values of FullName are padded
to 40 characters.
Correct answer: d
Use the INDEX function
in a subsetting IF statement, enclosing the character string in quotation
marks. Only those observations in which the function locates the string
and returns a value greater than 0 are written to the data set.