proc format;
value mf 1="Male" 2="Female";
value race 1="White" 2="Black" 3="Other";
run;
proc sgplot data=mac1.nh3p1jan;
histogram age;
run;
proc freq data=mac1.nh3p1jan;
tables race*gender/nocol nopercent chisq;
format gender mf. race race.;
run;
proc format;
value mf 1="Male" 2="Female";
value race 1="White" 2="Black" 3="Other";
run;
%let month=feb;
proc sgplot data=mac1.nh3p1&month;
histogram age;
run;
proc freq data=mac1.nh3p1&month;
tables race*gender/nocol nopercent chisq;
format gender mf. race race.;
run;
proc format;
value mf 1="Male" 2="Female";
value race 1="White" 2="Black" 3="Other";
run;
%let month=jan;
%let phase=1;
proc sgplot data=mac1.nh3p&phase&month;
histogram age;
run;
proc freq data=mac1.nh3p&phase&month;
tables race*gender/nocol nopercent chisq;
format gender mf. race race.;
run;
%let month=jan;
%let phase=1;
%let var=race;
proc sgplot data=mac1.nh3p&phase&month;
histogram age;
run;
proc freq data=mac1.nh3p&phase&month;
tables &var*gender/nocol nopercent chisq;
format gender mf. race race.;
run;
The word scanner recognizes the end of a macro variable reference when it encounters a character that cannot be part of the reference. A period (.) is a special delimiter that ends a macro variable reference. The period does not appear as text when the macro variable is resolved.
%let month=jan;
%let phase=1;
%let var=age;
%let lib=mac1;
proc sgplot data=&lib.nh3p&phase&month;
histogram age;
run;
%let month=jan;
%let phase=1;
%let var=age;
%let lib=mac1;
proc sgplot data=&lib..nh3p&phase&month;
histogram age;
run;