Select the best answer
for each question. After completing the quiz, check your answers using
the answer key in the appendix.
-
Which type of integrity
constraint would you place on the variable StoreID to ensure that
there are no missing values and that there are no duplicate values?
-
Which code creates an
audit trail on the SAS data set Reports.Quarter1?
-
proc datasets nolist;
audit quarter1;
initiate;
quit;
-
proc datasets lib=reports nolist;
audit initiate reports.quarter1;
quit;
-
proc datasets lib=reports nolist;
initiate audit quarter1;
quit;
-
proc datasets lib=reports nolist;
audit quarter1;
initiate;
quit;
-
Which DATA step uses
the transaction data set Records.Overnight to update the master data
set Records.Snowfall by accumAmt?
-
data records.snowfall;
modify records.snowfall records.overnight
key=accumAmt;
run;
-
data records.snowfall;
modify records.overnight records.snowfall;
by accumAmt;
run;
-
data records.snowfall;
modify records.snowfall records.overnight;
by accumAmt;
run;
-
data records.snowfall;
modify records.snowfall records.overnight;
update accumAmt;
run;
-
The automatic variable
_IORC_ is created when you use the MODIFY statement with a BY statement
or the KEY= option. How can you use the value of _IORC_?
-
to determine whether
the index specified on the KEY= option is a valid index
-
to determine the number
of observations that were updated in the master data set
-
to determine the status
of the
I/O operation
-
to determine the number
of observations that could not be updated in the master data set
-
Which PROC DATASETS
step creates an integrity constraint named val_age on the data set
Survey to ensure that values of the variable Age are greater than
or equal to 18?
-
proc datasets nolist;
modify age;
ic create val_age=check(where=(age>=18));
quit;
-
proc datasets nolist;
modify Survey;
ic create val_age=check(age>=18);
quit;
-
proc datasets nolist;
modify survey;
integrity constraint
val_age=check(where=(age>=18));
quit;
-
proc datasets nolist;
modify survey;
ic create val_age=check(where=(age>=18));
quit;
-
Which statement about
using the MODIFY statement in a DATA step is true?
-
MODIFY creates a second
copy of the data while variables in the data are being matched with
a WHERE clause and then deletes the second copy.
-
You cannot modify the
descriptor portion of the data set using the MODIFY statement.
-
You can use the MODIFY
statement to change the name of a variable.
-
If the system terminates
abnormally while a DATA step that is using the WHERE statement is
processing, SAS automatically saves a copy of the unaltered data set.
-
Which of the following
statements about audit trails is true?
-
They create historical
versions of data so that a copy of the data set is saved each time
the data is replaced.
-
They record information
about changes to observations in a data set each time the data set
is replaced.
-
They record information
about changes to observations in a data set each time the data is
modified in place.
-
The audit trail file
has the same name as the SAS data file that it is monitoring, but
has #AUDIT at the end of the data set name.
-
Which code initiates
generation data sets on the existing SAS data set Sasuser.Amounts
and specifies that five historical versions are saved in addition
to the base version?
-
proc datasets lib=sasuser nolist;
modify Amounts (genmax=6);
quit;
-
proc datasets lib=sasuser nolist;
modify Amounts (genmax=5);
quit;
-
proc datasets lib=sasuser nolist;
modify Amounts (gennum=6);
quit;
-
proc datasets lib=sasuser nolist;
modify Amounts (gennum=5);
quit;
-
Which statement about
using the KEY= option in the MODIFY statement is true?
-
SAS locates the variables
to update using the index specified in the KEY= option and then automatically
overlays nonmissing transaction values as it does when you use the
MODIFY or BY statements.
-
When you use the KEY=
option, you must explicitly state the update that you want to make.
SAS does not automatically overlay nonmissing transaction values.
-
The KEY= option is used
to specify a variable to match for updating observations.
-
The index named in the
KEY= option must be a simple index.
-
Which code deletes all
generations of the data set Sasuser.Amounts including the base data
set?
-
proc datasets lib=sasuser nolist;
delete amounts (gennum=ALL);
quit;
-
proc datasets lib=sasuser nolist;
delete amounts (gennum=HIST);
quit;
-
proc datasets lib=sasuser nolist;
delete amounts (gennum=0);
quit;
-
proc datasets lib=sasuser nolist;
delete amounts;
quit;