BookmarkSubscribeRSS Feed
Sean_OConnor
Fluorite | Level 6

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;
2 REPLIES 2
PaigeMiller
Diamond | Level 26

Look at the ODS LAYOUT GRIDDED command.

--
Paige Miller
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1001 views
  • 0 likes
  • 3 in conversation