SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Improving Program Efficiency with Macro Variables
Creating Your Own Macro Variables


SYMBOLGEN Option

Now that you know how to create and reference macro variables in your programs, you may want to use the SYMBOLGEN system option. This option specifies whether messages regarding the resolution of macro variable references are written to the SAS log. These messages can help you verify the values of macro variables that are referenced in your program.


General form, OPTIONS statement with SYMBOLGEN option:
OPTIONS NOSYMBOLGEN | SYMBOLGEN;

where

  • NOSYMBOLGEN specifies that log messages will not be displayed. The default is NOSYMBOLGEN.

  • SYMBOLGEN specifies that log messages will be displayed.


Let's see how this option works by specifying the SYMBOLGEN option and resubmitting the program about temporary employees. Remember that SAS system options can be specified in an OPTIONS statement.
     options symbolgen;
     %let year=1999;
     title "Temporary Employees for &year";
     data hrd.newtemp;
        set hrd.temp;
        if year(enddate)=&year;
     run;
     proc print data=hrd.newtemp;
     run;

Here are the log messages produced by the SYMBOLGEN option. Notice that a message is displayed for each resolved macro variable reference.


SAS Log
36  options symbolgen;
37  %let year=1999;
38  data hrd.newtemp;
39     set hrd.temp;
40     if year(enddate)=&year;
SYMBOLGEN: Macro variable YEAR resolves to 1999

NOTE: The data set HRD.NEWTEMP has 8 observations
      and 18 variables.
NOTE: The DATA statement used 0.71 seconds.

41  proc print data=hrd.newtemp;
SYMBOLGEN: Macro variable YEAR resolves to 1999
42     title "Temporary Employees for &year";
43  run;



  back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement