SAS macro variables enable you to substitute text in
your SAS programs. Macro variables can supply a variety of information,
including
-
operating system information
-
-
When you reference a
macro variable in a SAS program, SAS replaces the reference with the
text value that has been assigned to that macro variable. By substituting
text into programs, SAS macro variables make your programs more reusable
and dynamic.
The following sample
code shows how a macro variable might be used to substitute a year
value throughout a program, enabling you to quickly and easily change
the value of
year
throughout the program:
%let year=2002;
proc print data=sasuser.schedule;
where year(begin_date)=&year;
title "Scheduled Classes for &year";
run;
proc means data=sasuser.all sum;
where year(begin_date)=&year;
class location;
var fee;
title1 "Total Fees for &year Classes";
title2 "by Training Center";
run;