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 statement in the 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: 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. You can run PROC CONTENTS on the data
set to see the length of each variable.
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.
Correct answer: b
The variables Age, Weight,
and Group are specified using the KEEP= option in the SET statement.
When Cert.Fitness is being read, Age, Weight, and Group are the variables
that create Work.Cardiac. The variables Age and Group are specified
in the DROP= option in the DATA statement. Age and Group are dropped
from Work.Cardiac.
Correct answer: c
You specify the data
set to be created in the DATA statement. The DROP= data set option
prevents variables from being written to the data set. Because you
use the variable OrdrTime when processing your data, you cannot drop
OrdrTime in the SET statement. If you use the KEEP= option in the
SET statement, then you must list OrdrTime as one of the variables
to be kept.