Chapter 7: Creating and Using Macro Variables

  1. Correct answer: b
    Macro variables are always text strings that are independent of SAS data sets. The value of a macro variable can be up to 65,534 characters long, and the name of a macro variable can be up to 32 characters long. A macro variable can be defined or referenced anywhere in a SAS program except within data lines. There are two types of macro variables: automatic and user-defined.
  2. Correct answer: c
    To reference a macro variable, you precede the name with an ampersand. You do not need to enclose the macro variable reference in quotation marks.
  3. Correct answer: a
    There are two ways to display the value of a macro variable in the SAS log: you can turn on the SYMBOLGEN system option to list the values of all macro variables that are used, or you can use the %PUT statement to write specific text, including macro variable values, to the log. Therefore, answers b, c, and d are all valid ways to display the value of the macro variable in the SAS log.
  4. Correct answer: d
    You use the %LET statement to define a macro variable. You do not need to enclose the value in quotation marks. If you do include quotation marks in the assigned value for a macro variable, the quotation marks will be stored as part of the value.
  5. Correct answer: d
    Macro variables are stored as character strings. Quotation marks and most special characters are stored exactly as they are assigned, but leading blanks are stripped from assigned values. You can also include references to other macro variables within %LET statements.
  6. Correct answer: a
    Macro triggers alert the word scanner that the subsequent code should be sent to the macro processor. When a macro trigger is embedded within a literal token and you want to resolve the trigger, enclose the literal string in double quotation marks. If you do not enclose the string in double quotation marks, the macro variable reference is not resolved.
  7. Correct answer: b
    The word scanner recognizes four types of tokens. Expressions are not a type of token.
  8. Correct answer: b
    The word scanner, not the macro processor, breaks SAS programs into tokens.
  9. Correct answer: a
    The word scanner detects the end of a token when it encounters a new token or a blank delimiter. When the word scanner finds a blank or the beginning of a new token, it removes a token from the input stack and transfers it to the bottom of the queue.
Last updated: October 16, 2019
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.201.206