SAS Training Self-Assessment

SAS Report Writing 1: Using Procedures and ODS

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. What is the default justification for a numeric variable in a PROC PRINT report?

     a.   left-justified
     b.   right-justified
     c.   center-justified
     d.   decimal-justified


  4. By default, when do labels appear in a PROC PRINT report?

     a.   always
     b.   only when they are permanent labels
     c.   only when a LABEL statement is in the PROC PRINT step
     d.   only when the LABEL option or SPLIT= option is in the PROC PRINT statement


  5. What determines colors and fonts when you send a PROC PRINT report to the ODS HTML destination?

     a.   the SAS data set
     b.   an ATTRIBUTE statement
     c.   ODSCOLOR and ODSFONT statements
     d.   the default ODS style template or template name specified in the STYLE= option


  6. Which data set option selects variables?

     a.   COL=
     b.   VAR=
     c.   KEEP=
     d.   SELECT=


  7. Which statement selects observations in a procedure step?

     a.   IF
     b.   RETAIN
     c.   WHERE
     d.   INCLUDE


  8. What sort sequence does PROC SORT use by default?

     a.   ascending order
     b.   descending order
     c.   numeric variable values in descending order and character values in ascending order
     d.   numeric variable values in ascending order and character values in descending order


  9. Which statements can be used in a PROC PRINT step?

     a.   TITLE, IF, FORMAT, SET
     b.   TITLE, LABEL, FORMAT, IF
     c.   TITLE, LABEL, BY, FORMAT
     d.   TITLE, LABEL, MERGE, sum


  10. What does a character format name begin with?

     a.   dollar sign ($)
     b.   percent sign (%)
     c.   pound or hash sign (#)
     d.   character value (a-z or A-Z)


  11. Which FORMAT statement formats the variable Salary with dollar signs, commas, and two decimal places?

     a.   format Salary $14*2;
     b.   format Salary $14(2);
     c.   format Salary dolcom14-2;
     d.   format Salary dollar14.2;


  12. Which is a valid LIBNAME statement?

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


  13. Consider the following PROC SORT step:
    proc sort data=customers;
       <insert statement here>
    run;
    Which statement completes the step and sorts the observations in descending order by ID and, within ID, in ascending order by LastName?

     a.   by ID descending LastName;
     b.   by descending ID LastName;
     c.   by descending ID ascending LastName;
     d.   by ID descending LastName ascending;


  14. Which TITLE statement correctly codes the title Fred's Report?

     a.   title "Fred's Report";
     b.   title 'Fred' ''s Report';
     c.   title ' "Fred's Report" ';
     d.   title allowquote(Fred's Report);


  15. Which option is used to identify an input SAS data set to a SAS procedure?

     a.   SET=
     b.   DATA=
     c.   INPUT=
     d.   INFILE=


  16. 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 'myfile.html';
     b.   ods file='myfile.html';
     c.   ods html='myfile.html';
     d.   ods html file='myfile.html';


  17. Which statement clears all titles?

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


  18. Which statement correctly closes the LISTING destination?

     a.   ods;
     b.   ods close;
     c.   ods listing close;
     d.   ods _listing_ close;


  19. Where can ODS reports be viewed?

     a.   a browser
     b.   a word processor
     c.   the Output window in the SAS windowing environment
     d.   all of the above


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