Folks,
I've written a macro which creats graphs of distributions of variables. However, what happens is that each graph gets printed to one page. What I would like to do is merge the four grpahs on to one page so I can stick it into a word document.
Any help at amending my code would be most welcome.
%macro dists;
%do year = 2011 %to 2015;
********Employee Pay at the individual level vs survey equiv*****************;
data temp&year.;
set combined_sample_&year._7(keep = year pay spay);
array temp{*} pay spay;
do i = 1 to dim(temp);
temp(i) = round(temp(i),500);
end;
run;
proc summary data = temp&year. nway;
class year spay;
var spay;
output n= out = comb1a&year.;
run;
proc summary data = temp&year. nway;
class year spay;
var pay;
output n= out = comb1b&year.;
run;
data comb2&year.;
merge comb1a&year.
comb1b&year.(rename = (pay = spay_freq_ = regfreq));
by year spay;
run;
data comb2&year.;
set comb2&year.;
if spay= 0 then delete;run;
proc sgpanel data = comb2&year.;
panelby year;
vbar spay/ response = regfreq stat = percent legendlabel = "Register sample";
vbar spay/ response = _freq_ stat = percent legendlabel = "Survey sample" barwidth=0.5 transparency=0.6;
colaxis fitpolicy = rotatethin;
title "Distributions of Employee Income by Individual - Admin vs Survey, matched sample &year.";
run;
proc corr data= temp&year.; var pay spay;run;
%end;
%mend;
%dists;
Look at the ODS LAYOUT GRIDDED command.
You could also write the template yourself, you can get started on the template by simply adding:
proc sgpanel data = comb2&year. tmplout="c:\temp.txt";
Once run, this writes the Graph Template Language code to the file temp.txt. You can use this as the basis of creating a gridded graph with various overlays and such like - in fact all the latest graphing procedures use this GTL behind the scenes. You can learn further at:
http://blogs.sas.com/content/graphicallyspeaking/
Which has examples of pretty much any graphic you can think of.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.