SAS Training Self-Assessment

SAS Programming 2: Data Manipulation Techniques

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

  1. What are the components of a SAS data set?

     a.   row portion and column portion
     b.   value portion and format portion
     c.   data portion and descriptor portion
     d.   variable portion and observation portion


  2. What are the required attributes of a variable?

     a.   name, type, and length
     b.   name, type, and format
     c.   name, label, and length
     d.   name, label, and format


  3. In which DATA step phase are variable attributes assigned?

     a.   output
     b.   execution
     c.   compilation
     d.   initialization


  4. In which DATA step phase are variable values assigned?

     a.   output
     b.   execution
     c.   compilation
     d.   initialization


  5. Which DATA step statement selects variables?

     a.   VAR
     b.   KEEP
     c.   SELECT
     d.   subsetting IF


  6. Which DATA step statement selects observations?

     a.   VAR
     b.   KEEP
     c.   SELECT
     d.   subsetting IF


  7. What happens at the top of the DATA step?

     a.   The PDV is initialized.
     b.   Variable names are verified.
     c.   An implicit BEGIN statement is executed.
     d.   An implicit DO UNTIL statement is executed.


  8. By default, what happens at the bottom of the DATA step?

     a.   The PDV is initialized.
     b.   Variable names are verified.
     c.   An implicit END statement is executed.
     d.   An implicit OUTPUT statement is executed.


  9. Which character must all format and informat names contain?

     a.   period (.)
     b.   hyphen (-)
     c.   comma (,)
     d.   underscore (_)


  10. Which is a valid LIBNAME statement?

     a.   libname 'c:\sasfiles' mylib;
     b.   libname mylib 'c:\sasfiles';
     c.   libname libref=mylib 'c:\sasfiles';
     d.   libname 'c:\sasfiles' libref=mylib;


  11. What happens when SAS reads a raw data file and encounters a data error?

     a.   The program terminates immediately without warning.
     b.   A note is written to the log, and processing continues.
     c.   An error message is written to the log, and execution fails.
     d.   A warning message is written to the log, and processing is halted.


  12. Which statement reads a SAS data set?

     a.   SET
     b.   READ
     c.   INPUT
     d.   INFILE


  13. Consider the following program:
    <insert statement here>
       proc print data=customers;
       run;
    ods html close;
    Which statement correctly starts the capture of HTML output and names an HTML result file?

     a.   ods html;
     b.   ods html open;
     c.   ods html file='myfile.html';
     d.   ods html open file='myfile.html';


  14. Which statement clears all titles?

     a.   title;
     b.   title clear;
     c.   clear_titles;
     d.   clear all_titles;


  15. Which statement correctly calls the SUM function?

     a.   Total = sum(Qtr1 Qtr2 Qtr3);
     b.   Total = sum(Qtr1, Qtr2, Qtr3);
     c.   sum(Total) = (Qtr1, Qtr2, Qtr3);
     d.   Total = sum of (Qtr1 Qtr2 Qtr3);


  16. Which is true of match-merging?

     a.   Only two data sets can be merged at one time.
     b.   Only matches are included in the resulting data set.
     c.   There can be multiple BY statements for one MERGE statement.
     d.   Each data set must be in order or indexed by the BY variable (or BY variables).


  17. What happens when a DATA step or PROC step contains multiple WHERE statements?

     a.   Only the first WHERE statement is processed.
     b.   The WHERE conditions are combined with a logical AND operator.
     c.   The last WHERE statement replaces previous WHERE statements.
     d.   A syntax error is displayed in the log, and the program does not execute.