Chapter 8: Storing and Processing Text

  1. Correct answer: c
    Most macro functions are handled by the macro processor before any SAS language statements in the DATA step are executed. For example, the %LET statement and any macro variable references (&macvar) are passed to the macro processor before the program is compiled. In order to create or update macro variables during DATA step execution, you use the SYMPUT routine.
  2. Correct answer: d
    The SYMPUTX routine enables you to assign a data set variable as the value of a macro variable. You can also use the SYMPUTX routine to create a series of related macro variables. Because all macro variable values are character strings, SYMPUTX automatically converts any numeric value that you attempt to assign as a value for a macro variable.
  3. Correct answer: b
    You can use multiple ampersands to create an indirect reference when the value of one macro variable is the name of another. If you enclose the DATA step variable name in quotation marks in the SYMPUTX routine, the new macro variable will have the same name as the DATA step variable rather than having the DATA step variable's value as a name. Use the SYMGET function to obtain the value of a macro variable during the execution of a DATA step.
  4. Correct answer: b
    If more than four consecutive ampersands precede a name token, re-scanning continues from left to right until no more triggers can be resolved. The Forward Re-scan rule describes how the macro processor resolves macro variable references that start with multiple ampersands or with multiple percent signs.
  5. Correct answer: c
    To create a macro variable during the execution of a PROC SQL step, use the INTO clause of the SELECT statement. In the INTO clause, you precede the name of the macro variable with a colon.
  6. Correct answer: c
    You can use multiple ampersands to delay the resolution of a macro variable reference. You can also combine macro variable references in order to create new tokens. In this example, the reference &&teach&crs resolves to &teach3 on the first scan. On the next scan, &teach3 resolves to Forest, Mr. Peter.
  7. Correct answer: b
    The SYMPUTX routine can be used in a DATA step. In the DATA step, the SYMPUTX routine performs automatic conversion on numeric values that you attempt to assign as values for macro variables, using the BEST12. format. However, you cannot use the SYMPUTX routine to create a macro variable during the execution of a PROC SQL query.
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
18.216.168.162