Program c correctly
deletes the observation in which the value of Finish is oak and the
value of Price is less than 200. It also creates TotalPrice by summing
the variable Price down observations, and then drops Price by using
the DROP= data set option in the DATA statement.
Correct answer: b
The PROC PRINT output
displays the label Total Amount Loaned for the variable Amount and
formats this variable using the COMMA10. format. Temporary labels
or formats that are assigned in a PROC step override permanent labels
or formats that are assigned in a DATA step.
Correct answer: c
Logical comparisons
that are enclosed in parentheses are evaluated as true or false before
they are compared to other expressions. In the example, the AND comparison
within the nested parentheses is evaluated before being compared to
the OR comparison.
Correct answer: d
The sum statement adds
the result of the expression that is on the right side of the plus
sign to the numeric variable that is on the left side. The new value
is then retained for subsequent observations. The sum statement ignores
the missing value, so the value of Count in the fourth observation
would be 10+20+0+40, or 70.
Correct answer: d
The RETAIN statement
assigns an initial value of 100 to the variable Count, so the value
of Count in the third observation would be 100+10+20+0, or 130.
Correct answer: b
You must enclose character
values in quotation marks, and you must specify them in the same case
in which they appear in the data set. The value OK is
not identical to Ok, so the value of Count is not changed by the IF-THEN
statement.
Correct answer: d
The length of a variable
is determined by its first reference in the DATA step. When creating
a new character variable, SAS allocates as many bytes of storage space
as there are characters in the reference to that variable. The first
reference to a new variable can also be made with a LENGTH statement
or an assignment statement.
Correct answer: a
You can write multiple
ELSE statements to specify a series of mutually exclusive conditions.
The ELSE statement must immediately follow the IF-THEN statement in
your program. An ELSE statement executes only if the previous IF-THEN/ELSE
statement is false.
Correct answer: a
The length of a new
variable is determined by the first reference in the DATA step, not
by data values. In this case, the length of Type is determined by
the value Fixed. The LENGTH statement is in the wrong place; it must
occur before any other reference to the variable in the DATA step.
Correct answer: b
To select variables,
you can use a DROP or KEEP statement in any DATA step. You can also
use the DROP= or KEEP= data set options following a data set name
in any DATA or PROC step. However, you cannot use DROP or KEEP statements
in PROC steps.