SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Improving Program Efficiency with Macro Variables
Creating Your Own Macro Variables


Using Suffixes That Begin with a Period

If your macro variable reference must appear before a suffix that begins with a period, you must specify two periods between the macro variable reference and the suffix. The first period ends the macro variable reference. The second period is the period that separates the first and second level names of your data set.

     %let yr=1999;
     %let period=end;
     %let libref=hrd;
     title "Temporary Employees for &yr";
     data &libref..temp&yr;
        set &libref..temp;
        if year(&period.date)=&yr;
     run;
     proc print data=&libref..temp&yr;
     run;

When using two periods, the macro variable references in your program resolve correctly. For example, the DATA statement

     data &libref..temp&yr;

is processed by SAS software as

     data hrd.temp1999;

  back||next


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

Terms of Use & Legal Information | Privacy Statement