SAS Chapter 9: Introducing Macro Variables

10 Questions | Total Attempts: 291

SettingsSettingsSettings
SAS Quizzes & Trivia

Practice for the SAS advance certification exam


Questions and Answers
  • 1. 
    Which of the following statements is false?
    • A. 

      A macro variable can be defined and referenced anywhere in a SAS program except within data lines.

    • B. 

      Macro variables are always user-defined, and their values remain constant until they are changed by the user.

    • C. 

      Macro variables are text strings that are independent of SAS data sets.

    • D. 

      The values of macro variables can be up to 65,534 characters long.

  • 2. 
    Which of the following statements will generate an error message while trying to display the value of the macro variable month in the SAS log?
    • A. 

      Title "Total Sales for '&month' ";

    • B. 

      Title "Total Sales for 'month'";

    • C. 

      Title "Total Sales for &month";

    • D. 

      Title Total Sales for "&month";

  • 3. 
    Which of the following statements will generate an error message while trying to display the value of the macro variable month in the SAS log?
    • A. 

      Options &month;

    • B. 

      %PUT &month;

    • C. 

      Options symbolgen;

    • D. 

      %PUT the macro variable MONTH has the value &month.;

  • 4. 
    Which statement will create a macro variable named location that has the value storage?
    • A. 

      &let location = storage;

    • B. 

      Let &location = storage;

    • C. 

      %let location = "storage";

    • D. 

      %let location = storage;

  • 5. 
    What value will these statements assign to the macro variable reptitle: %let area = "Southeast"; %let reptitle = * Sales Report for &area Area *;
    • A. 

      Sales Report for Southeast Area

    • B. 

      Sales Report for "Southeast" Area

    • C. 

      *Sales Report for "Southeast" Area*

    • D. 

      * Sales Report for "Southeast" Area *

  • 6. 
    Assuming that you began your SAS session today, which of the following statements correctly sets the macro variable currdate to today's date:
    • A. 

      %let currdate = %sysfunc(today(), worddate.);

    • B. 

      %let currdate = &sysdate9;

    • C. 

      %let currdate = %sysfunc(date());

    • D. 

      All of the above

  • 7. 
    Macro character functions
    • A. 

      Can be used to manipulate character strings in macro variable values.

    • B. 

      Have the same basic syntax as the corresponding DATA step functions and yield similar results.

    • C. 

      All of the above

    • D. 

      None of the above

  • 8. 
    The four types of tokens that SAS recognizes are
    • A. 

      Expressions, literals, names, and special characters.

    • B. 

      Literals, names, numbers, and special characters.

    • C. 

      Expressions, names, numbers, and special characters.

    • D. 

      Expressions, literals, numbers, and special characters.

  • 9. 
    What are the resulting values for the macro variables that are defined here? %let month1 = June; %let month2 = July; %let period1 = &month1&month2; %let period2 = May&month1; %let period3 = &month2.Aug;
    • A. 

      month1 June month2 July period1 June July period2 May June period3 July Aug

    • B. 

      month1 June month2 July period1 JuneJuly period2 MayJune period3 July.Aug

    • C. 

      month1 June month2 July period1 JuneJuly period2 MayJune period3 JulyAug

    • D. 

      month1 June month2 July period1 junejuly period2 Mayjune period3 julyaug

  • 10. 
    Which of the following correctly produces a title in which the current date is left justified in order to remove extra blanks?
    • A. 

      title "Report for %sysfunc(left(%sysfunc(today(),worddate.)))";

    • B. 

      title "Report for %sysfunc(left(today(), worddate.))";

    • C. 

      title "Report for %sysfunc(left(%qsysfunc(today(), worddate.)))";

    • D. 

      title "Report for %left(today(), worddate.))";

Related Topics
Back to Top Back to top