Chapter Review Quiz


Reading SAS Data Sets

Select the best answer for each question. When you are finished, click Submit Quiz.

  1. What statement is used to read a SAS data set in a DATA step?

     a.   DATA statement
     b.   WHERE statement
     c.   SET statement
     d.   assignment statement


  2. What is the name of the input data set in the program below?

    data work.us;
       set orion.sales;
       where Country='US';
    run;
     a.   work.us
     b.   orion.sales
     c.   Country
     d.   sales


  3. What is the name of the output data set in the program below?

    data work.us;
       set orion.sales;
       where Country='US';
    run; 
     a.   work.us
     b.   orion.sales
     c.   Country
     d.   sales


  4. Which of the following DATA steps correctly reads the permanent data set salesinfo from the sporting library and creates a new data set named salesinfo2 in the same library?


     a.  
    data sporting.salesinfo2;
       set salesinfo;
    run;
     b.  
    data salesinfo2;
       set sporting.salesinfo;
    run;
     c.  
    data sporting.salesinfo2;
       set sporting.salesinfo;
    run;


  5. Which of the following is not created during the compilation phase?

     a.   the descriptor portion of the output data set
     b.   the first observation
     c.   the program data vector (PDV)


  6. The data set orion.sales contains nine variables. Given this DATA step, how many variables does the descriptor portion of work.comp contain?

    data work.comp;
       set orion.sales;
       drop Gender Salary Birth_Date;
    run;
     a.   six
     b.   seven
     c.   nine
     d.   None. This program contains a logic error.


  7. The data set orion.sales contains nine variables. Given this DATA step, how many variables does the descriptor portion of work.comp contain?

    data work.comp;
       set orion.sales;
       keep Employee_ID Gender Job_Title Salary;
    run;
     a.   four
     b.   nine
     c.   13
     d.   None. This program contains a logic error.


  8. A KEEP statement in a DATA step omits all variables except Name, Color, and Price from the output data set. Are the omitted variables included in the PDV?

     a.   Yes
     b.   No


  9. What value will be assigned to Units?

    data work.comp;
       set work.sales;
       Units=Total+Bonus/Quantity;
    run;

    PDV
    Total
    Quantity
    Bonus
    Units
    140
    10
    50
    .

     a.   19
     b.   145
     c.   3
     d.   missing


  10. Which procedure can be used to view the permanent labels and formats stored in a data set?

     a.   PROC CONTENTS
     b.   PROC PRINT
     b.   PROC FORMAT
     b.   PROC UNIVARIATE