Desktop productivity for business analysts and programmers

Printing four graphs on to one page.

Reply
Contributor
Posts: 45

Printing four graphs on to one page.

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;
Trusted Advisor
Posts: 1,932

Re: Printing four graphs on to one page.

Posted in reply to Sean_OConnor

Look at the ODS LAYOUT GRIDDED command.

Super User
Super User
Posts: 7,988

Re: Printing four graphs on to one page.

Posted in reply to Sean_OConnor

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.

Ask a Question
Discussion stats
  • 2 replies
  • 164 views
  • 0 likes
  • 3 in conversation