Introduction

SAS macro variables enable you to substitute text in your SAS programs. Macro variables can supply a variety of information, from operating system information to SAS session information to any text string that you define. By enabling you to substitute text into programs, SAS macro variables make your programs easy to update, as this program shows:

     %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;

This lesson teaches you how to use the automatic macro variables that are supplied by SAS and to create and reference your own macro variables.



1.5 hours



In this lesson, you learn to

  • create macro variables with the %LET statement
  • create macro variables with the CALL SYMPUT routine
  • reference automatic and user-defined macro variables
  • identify when macro variable references are resolved
  • display log messages stating how macro variable references resolve by using the SYMBOLGEN option
  • combine macro variable references with prefixes and suffixes.

complete the following lessons:

  • .