SAS Chapter 18: Modifying SAS Data Sets And Tracking Changes

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Moxleyv
M
Moxleyv
Community Contributor
Quizzes Created: 38 | Total Attempts: 20,684
Questions: 10 | Attempts: 125

SettingsSettingsSettings
SAS Quizzes & Trivia

Practice for the SAS advance certification exam


Questions and Answers
  • 1. 

    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?

    • A.

      UNIQUE

    • B.

      CHECK

    • C.

      PRIMARY KEY

    • D.

      NOT NULL

    Correct Answer
    C. PRIMARY KEY
    Explanation
    The PRIMARY KEY integrity constraint includes both the NOT NULL and UNIQUE constraints.

    Rate this question:

  • 2. 

    Which code creates an audit trail on the SAS data set Reports.Quarter1?

    • A.

      proc datasets nolist; audit quarter1; initiate; quit;

    • B.

      proc datasets lib=reports nolist; audit initiate reports.quarter1; quit;

    • C.

      proc datasets lib=reports nolist; initiate audit quarter1; quit;

    • D.

      proc datasets lib=reports nolist; audit quarter1; initiate; quit;

    Correct Answer
    D. proc datasets lib=reports nolist; audit quarter1; initiate; quit;
    Explanation
    To initiate an audit on an existing SAS data set with the DATASETS procedure, you specify the data set in the AUDIT statement, and then you specify the INITIATE statement. You specify the library with the LIB= option.

    Rate this question:

  • 3. 

    Which DATA step uses the transaction data set Records.Overnight to update the master data set Records.Snowfall by accumAmt?

    • A.

      data records.snowfall; modify records.snowfall records.overnight key=accumAmt; run;

    • B.

      data records.snowfall; modify records.overnight records.snowfall; by accumAmt; run;

    • C.

      data records.snowfall; modify records.snowfall records.overnight; by accumAmt; run;

    • D.

      data records.snowfall; modify records.snowfall records.overnight; update accumAmt; run;

    Correct Answer
    C. data records.snowfall; modify records.snowfall records.overnight; by accumAmt; run;
    Explanation
    In the MODIFY statement, you specify the master data set followed by the transaction data set. Then you specify the variable in the BY statement.

    Rate this question:

  • 4. 

    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_?

    • A.

      To determine whether the index specified on the KEY= option is a valid index

    • B.

      To determine the number of observations that were updated in the master data set

    • C.

      To determine the status of the I/O operation

    • D.

      To determine the number of observations that could not be updated in the master data set

    Correct Answer
    C. To determine the status of the I/O operation
    Explanation
    The value of _IORC_ is a numeric return code that indicates the status of the most recently executed I/O operation. Checking the value of this variable allows you to detect abnormal I/O conditions and direct execution in particular ways.

    Rate this question:

  • 5. 

    Which PROC DATASETS step creates an integrity constraint named val_age on the data set Survey to ensure that values of the variableage are greater than or equal to 18?

    • A.

      proc datasets nolist; modify age; ic create val_age=check(where=(age>=18)); quit;

    • B.

      proc datasets nolist; modify Survey; ic create val_age=check(age>=18); quit;

    • C.

      proc datasets nolist; modify survey; integrity constraint val_age=check(where=(age>=18)); quit;

    • D.

      proc datasets nolist; modify survey; ic create val_age=check(where=(age>=18)); quit;

    Correct Answer
    D. proc datasets nolist; modify survey; ic create val_age=check(where=(age>=18)); quit;
    Explanation
    In the MODIFY statement, you list the SAS data set that you want to modify. Then you use the IC CREATE statement to create the integrity constraint. This integrity constraint is a CHECK constraint and you use a WHERE clause to specify the condition that the variable values must meet.

    Rate this question:

  • 6. 

    Which statement about using the MODIFY statement in a DATA step is true?

    • A.

      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.

    • B.

      You cannot modify the descriptor portion of the data set using the MODIFY statement.

    • C.

      You can use the MODIFY statement to change the name of a variable.

    • D.

      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.

    Correct Answer
    B. You cannot modify the descriptor portion of the data set using the MODIFY statement.
    Explanation
    The MODIFY statement in a DATA step can be used only to modify the values in a data set. It cannot be used to modify the descriptor portion of the data set.

    Rate this question:

  • 7. 

    Which of the following statements about audit trails is true?

    • A.

      They create historical versions of data so that a copy of the data set is saved each time the data is replaced.

    • B.

      They record information about changes to observations in a data set each time the data set is replaced.

    • C.

      They record information about changes to observations in a data set each time the data is modified in place.

    • D.

      The audit trail file has the same name as the SAS data file it is monitoring, but has #AUDIT at the end of the data set name.

    Correct Answer
    C. They record information about changes to observations in a data set each time the data is modified in place.
    Explanation
    Audit trails are used to track changes that are made to a data set in place.

    Rate this question:

  • 8. 

    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?

    • A.

      proc datasets lib=sasuser nolist; modify Amounts (genmax=6); quit;

    • B.

      proc datasets lib=sasuser nolist; modify Amounts (genmax=5); quit;

    • C.

      proc datasets lib=sasuser nolist; modify Amounts (gennum=6); quit;

    • D.

      proc datasets lib=sasuser nolist; modify Amounts (gennum=5); quit;

    Correct Answer
    A. proc datasets lib=sasuser nolist; modify Amounts (genmax=6); quit;
    Explanation
    You use the DATASETS procedure and the MODIFY statement to specify a number of generation data sets for a data set. The GENMAX= option is used to specify the number of versions to save. The number you specify includes the base version.

    Rate this question:

  • 9. 

    Which statement about using the KEY= option in the MODIFY statement is true?

    • A.

      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/BY statements.

    • B.

      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.

    • C.

      The KEY= option is used to specify a variable to match for updating observations.

    • D.

      The index named in the KEY= option must be a simple index.

    Correct Answer
    B. 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.
    Explanation
    When you use the KEY= option, you must specify the update that you want to make to the data set.

    Rate this question:

  • 10. 

    Which code deletes all generations of the data set Sasuser.Amounts including the base data set?

    • A.

      proc datasets lib=sasuser nolist; delete amounts (gennum=ALL); quit;

    • B.

      proc datasets lib=sasuser nolist; delete amounts (gennum=HIST); quit;

    • C.

      proc datasets lib=sasuser nolist; delete amounts (gennum=0); quit;

    • D.

      proc datasets lib=sasuser nolist; delete amounts; quit;

    Correct Answer
    A. proc datasets lib=sasuser nolist; delete amounts (gennum=ALL); quit;
    Explanation
    The keyword ALL is used to indicate that you want to delete all generations of the specified data set including the base version. The keyword HIST deletes the generation data sets, but saves the base version.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 18, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 02, 2013
    Quiz Created by
    Moxleyv

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.