Quiz

Select the best answer for each question. After completing the quiz, check your answers using the answer key in the appendix.
  1. Which of the following is false?
    1. A %LET statement causes the macro processor to create a macro variable before the program is compiled.
    2. To create a macro variable that is based on data calculated by the DATA step, you use the SYMPUT function.
    3. Macro functions are always processed during the execution of the DATA step.
    4. Macro variable references in a DATA step are always resolved before DATA step execution.
  2. Which of the following correctly creates a macro variable named region and assigns to it a value that is based on the value of the data set variable Location?
    1. data new;
         set sasuser.all;
         if location='Boston' then do;
            call symput('region', 'East'),
         end;
         else do;
            call symput('region', 'West'),
         end;
      run;
    2. data new;
         set sasuser.all;
         if location='Boston' then do;
            %let region=East;
         end;
         else
            %let region=West;
         end;
      run;
    3. data new;
         set sasuser.all;
         if location='Boston' then do;
            call symput(region, "East");
         end;
         else
            call symput(region, "West");
         end;
      run;
    4. data new;
         set sasuser.all;
         if location='Boston' then do;
            symput(region, East);
         end;
         else
            symput(region, West);
         end;
      run;
  3. The SYMPUT routine cannot
    1. be used to assign a data set variable as a value to a macro variable.
    2. create a series of macro variables in one DATA step.
    3. automatically convert a numeric value to a character value when used to assign a value to a macro variable in a DATA step.
    4. be used to assign a numeric value to a macro variable in an SCL program.
  4. Which of the following programs correctly creates a series of macro variables whose names are values of the data set variable Course_code, then indirectly references one of those macro variables in a later step?
    1. data _null_;
         set sasuser.courses;
         call symput(course_code, trim(course_title));
      %let crsid=C005;
      proc print data=sasuser.schedule noobs label;
         where course_code="&crsid";
         var location begin_date teacher;
         title1 "Schedule for &c005";
      run;
    2. data _null_;
         set sasuser.courses;
         call symput(course_code, trim(course_title));
      run;
      %let crsid=C005;
      proc print data=sasuser.schedule noobs label;
         where course_code="&crsid";
         var location begin_date teacher;
         title1 "Schedule for &&&crsid";
      run;
    3. data _null_;
         set sasuser.courses;
         call symput('course_code', trim(course_title));
      run;
      %let crsid=C005;
      proc print data=sasuser.schedule noobs label;
         where course_code="&crsid";
         var location begin_date teacher;
         title1 "Schedule for &&&crsid";
      run;
    4. data _null_;
         set sasuser.courses;
         call symget(course_code, trim(course_title));
      run;
      
      %let crsid=C005;
      proc print data=sasuser.schedule noobs label;
         where course_code="&crsid";
         var location begin_date teacher;
         title1 "Schedule for &&&crsid";
      run;
  5. Which of the following statements about the resolution of macro variable references is false?
    1. Two ampersands resolve to one ampersand.
    2. If more than four consecutive ampersands precede a name token, the macro processor generates an error message.
    3. Re-scanning continues until there are no remaining macro triggers that the macro processor can resolve.
    4. The macro processor always re-scans a name token that is preceded by multiple ampersands or by multiple percent signs.
  6. In which of the following situations would you use SYMGET rather than a macro variable reference (&macvar)?
    1. to create a DATA step variable from a macro variable value during the execution of the DATA step
    2. to include a macro variable reference in a PROC SQL view
    3. to access the value of a macro variable during the execution of an SCL program
    4. all of the above
  7. Which of the following correctly creates a macro variable in a PROC SQL step?
    1. call symput(daily_fee, put(fee/days, dollar8.);
    2. %let daily_fee=put(fee/days, dollar8.)
    3. select fee/days format=dollar8. 
      into :daily_fee from sasuser.all;
    4. select fee/days format=dollar8. 
      into daily_fee from sasuser.all;
  8. According to the global symbol table shown here, what is the resolved value for a reference to &&teach&crs?
    Global Symbol Table
    1. &TEACH3
    2. TEACH3
    3. Forest, Mr. Peter
    4. none of the above
  9. Which of the following statements correctly creates a DATA step variable named Price and assigns to it the value of the macro variable daily_fee during DATA step execution?
    1. price=&daily_fee;
    2. price=symget(daily_fee);
    3. price=symget(&daily_fee);
    4. price=symget("daily_fee");
  10. Which of the following is false?
    1. The SYMPUT routine can be used to create a macro variable during execution of the DATA step or during execution of an SCL program.
    2. In the DATA step, the SYMPUT routine automatically converts to a character value any numeric value that you attempt to assign as the value of a macro variable.
    3. PROC SQL automatically converts to a numeric value any macro variable value that you attempt to compare to a numeric value.
    4. In an SCL program, the SYMPUTN routine can be used to assign a numeric value to a macro variable.
..................Content has been hidden....................

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