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 statement is false concerning the compilation phase of the DATA step?

     a.   Initial values are assigned to the columns.
     b.   The program data vector (PDV) is created.
     c.   The DATA step is checked for syntax errors.
     d.   The descriptor portion of the output table is created.


  2. Which statement is true concerning the execution phase of the DATA step? 

     a.   Data is processed in the program data vector (PDV). 
     b.   An implied OUTPUT occurs at the top of the DATA step. 
     c.   An implied REINITIALIZE occurs at the bottom of the DATA step.
     d.   Columns read from the input table are set to missing when SAS returns to the top of the DATA step.


  3. 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


  4. Examine the following sum statement. Which statement is false?

    Total+Amount;

     a.   The sum statement ignores missing values for Amount.
     b.   The sum statement initially sets the Total column to missing.
     c.   The sum statements adds the numeric value from Amount to the accumulator column, Total.
     d.   The sum statement automatically retains the value of the Total column.


  5. Which DATA step statement indicates to continue processing the last row of a BY group?

     a.   if First.JobTitle;
     b.   if Last.JobTitle;
     c.   where First.JobTitle=1;
     d.   where Last.JobTitle=1;


  6. Which function calculates the average of the columns Week1, Week2, Week3, and Week4?

     a.   mean(Week1, Week4)
     b.   mean(Week1-Week4)
     c.   mean(of Week1, Week4)
     d.   mean(of Week1-Week4)


  7. Which of the following functions can convert the values of the numeric variable Level to character values?

     a.   put(Level, 3.)
     b.   put(3., Level)
     c.   input(3., Level)
     d.   input(Level, 3.)


  8. When creating a custom format in the FORMAT procedure, you specify the name of the format and the name of the column that will use the custom format.

     a.   True
     b.   False


  9. Which columns are required in an input table to create a format based on character values?

     a.   FMTNAME, START, and LABEL
     b.   FORMAT, START, END, and NAME
     c.   FMTNAME, START, END, and LABEL
     d.   FORMAT, START, LAST, NAME, and TYPE


  10. Which statement is true concerning concatenating tables?

     a.   All tables must have the same number of columns.
     b.   Columns in all tables must have matching names and lengths.
     c.   Tables must be in the same library.
     d.   Missing values are generated for columns that exist in one input table and not in another.


  11. Which statement is true concerning merging with matching rows?

     a.   The MERGE statement must refer to temporary input tables.
     b.   The columns in the BY statement can be in only one of the tables.
     c.   Only two input tables can be specified in the MERGE statement.
     d.   The input tables must be sorted by the columns in the BY statement.


  12. Which statement is true regarding the iterative DO loop?
    DO index-column = start TO stop <BY increment>; 

     a.   The start and stop values can be character or numeric values.
     b.   If an increment value is not specified, the default increment is 0.
     c.   The index column is incremented at the bottom of each DO loop. 
     d.   The index column is not in the final table unless specifically kept.


  13. Which of the following statements contains valid syntax?

     a.   do 1 to 10 by 2;
     b.   do while (Year>2025);
     c.   do until Earnings<=100000;
     d.   do date='01JAN2019' to '31JAN2019';


  14. Which statement is false?

     a.   The DO UNTIL loop executes until a condition is true.
     b.   The DO WHILE loop always executes at least one time.
     c.   The DO WHILE loop checks the condition at the top of the loop.
     d.   The DO UNTIL loop checks the condition at the bottom of the loop.


  15. Which statement is false concerning the TRANSPOSE procedure?

     a.   Columns are transposed into rows.
     b.   By default, numeric columns are transposed.
     c.   Use a BY statement to sort the data while transposing.
     d.   Use a VAR statement to specifically specify the character and numeric columns to transpose.