Select the best answer
for each question. Check your answers using the answer key in the
appendix.
-
Which of the following
statements is false when you use the BY statement with the SET statement?
-
The data sets listed
in the SET statement must be indexed or sorted by the values of the
BY variable or variables.
-
The DATA step automatically
creates two variables, FIRST. and LAST., for each variable in the
BY statement.
-
FIRST. and LAST. identify
the first and last observation in each BY group, respectively.
-
FIRST. and LAST. are
stored in the data set.
-
Your data does not require
any preprocessing if the observations in all of the data sets occur
in which of the following patterns?
-
Ascending or descending
character order.
-
Ascending or descending
numeric order.
-
The data must be grouped
in some way.
-
-
Which temporary variables
are available for DATA step programming during BY-group processing
only, but are not added to the data set?
-
FIRST.variable and
LAST.variable.
-
_N_ and _ERROR variables.
-
-
-
Which program below
creates the following output?
-
proc print data=cert.credit;
by type;
run;
-
proc sort data=cert.credit;
by type ascending;
run;
-
proc sort data=cert.credit;
by type;
run;
-
proc sort data=cert.credit;
by type descending;
run;
-
What statement correctly
describes a BY group?
-
It contains temporary
variables that SAS creates for each BY variable.
-
It includes all observations
with the same BY value.
-
It names a variable
or variables by which the data set is sorted.
-
It is a method of processing
observations from one or more SAS data sets that are group or ordered
by one or more common variables.
-
How does SAS determine
FIRST.variable?
-
When an observation
is the first in a BY group, SAS sets the value of the FIRST.variable to
1. This happens when the value of the variable changed from the previous
observation.
-
For all other observations
in the BY group, the value of FIRST.variable is
0.
-
-
When an observation
is the last in a BY group, SAS sets the value of FIRST.variable to
1.
-
Which program creates
the following output?
-
proc sort data=cert.choices out=work.choices;
by day flavor;
run;
proc print data=work.choices;
run;
-
proc sort data=cert.choices out=work.choices;
by day;
run;
proc print data=work.choices;
run;
-
proc print data=cert.choices out=work.choices;
by day;
run;
-
proc sort data=cert.choices out=work.choices;
by flavor;
run;
proc print data=work.choices;
run;