SAS Training Self-Assessment

SAS Programming 3: Advanced Techniques and Efficiencies

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

  1. Which variables are reinitialized with each iteration of the DATA step?

     a.   variables read with the SET statement
     b.   variables created by the INPUT statement
     c.   variables created by the assignment statement
     d.   both b and c

  2. Select the term that correctly completes the following sentence:

    The purpose of the RETAIN statement is to retain the _________ of a variable between iterations of the DATA step.

     a.   name
     b.   length
     c.   data type
     d.   previous value

  3. Which of the following happens during the compilation phase of a DATA step?

     a.   Data errors are detected.
     b.   Variable lengths are assigned.
     c.   Data is output to the data set being created.
     d.   Values are assigned to variables created by an assignment statement.

  4. Which of the following assignment statements creates a SAS date value for the variable DTE?

     a.   DTE='4JUL2010';
     b.   DTE='4JUL2010'd;
     c.   DTE='07/04/2010';
     d.   DTE='07/04/2010'd;

  5. What value is stored in the automatic variable _N_?

     a.   the number of iterations of the DATA step
     b.   the number of data errors that have occurred
     c.   the number of observations read from the input source
     d.   the number of observations written to the output data set

  6. Consider the following sum statement:

    Which of the following describes the statement?

     a.   The variable Total is retained.
     b.   The variable Amount is initialized to 0.
     c.   Both a and b.
     d.   None of the above.

  7. Consider the following raw data file:


    Which INPUT statement correctly reads the record?

     a.   input Animal_Type, Age, Name, Weight;

    input (Animal_Type Age Name Weight) $;

     c.   input Animal_Type $ Age Name $ Weight;
     d.   input Animal_Type $ Age N Name $ Weight N;

  8. Consider the following iterative DO loop:
    do i=1 to 20 by 3;
    How many times will the assignment statement execute?

     a.   3
     b.   7
     c.   8
     d.   20

  9. Which ARRAY statement associates an array named ARY with the numeric variables X, Y, Z, and W?

     a.   array ARY{4};
     b.   array ARY{4} X Y Z W;
     c.   array ARY{X Y Z W};
     d.   array ARY * X Y Z W;

  10. Consider the following statement:

    What is the value of the variable NewVar?

     a.   CDE
     b.   EFG
     c.   CDEFG
     d.   missing character value

  11. What is a SAS array?

     a.   a hashing table
     b.   a SAS data set that is arranged in a particular order
     c.   a temporary grouping of SAS variables that are arranged in a particular order
     d.   a permanent grouping of SAS variables that are arranged in a particular order

  12. What does the IN= data set option create when it is used with the MERGE statement?

     a.   a list of variables to include in the output data set
     b.   a list of variables to be read from the input data set
     c.   a variable that can be used to identify only the matches
     d.   a variable that can be used to identify matches and non-matches

  13. Consider the following INPUT statement:

    input @1 type $2. @;
    What effect does the single trailing @ have on the statement?

     a.   It triggers the read of the next input record.
     b.   It advances the pointer to column 1 of the next input line.
     c.   It advances the pointer to the next column on the current input line.
     d.   It holds the input record for the execution of the next INPUT statement.

  14. Which function is used to convert character values to numeric values?

     a.   PUT
     b.   CHAR
     c.   INPUT
     d.   NUMBER