|
HOW CAN I REPLAY FOUR CHARTS ON A PAGE AND HAVE A SINGLE TITLE AT THE TOP OF THE PAGE AND A SINGLE FOOTNOTE AT THE BOTTOM OF THE PAGE? Question: I want to replay four charts on a page and have a single title appear across the top of the page, and a single footnote across the bottom. What is the best way to accomplish this? Answer: The best approach is to create a template containing five panels using the GREPLAY procedure in the SAS/GRAPH product. The first four panels divide the graphics display area into four quadrants, and contain your four charts. The fifth panel fills the entire graphics display area, overlays the other four panels, and contains the title and footnote text produced by the GSLIDE procedure. The following program provides a simple approach using the SASUSER.HOUSES data set from SAS/ASSIST software to create four graphs with the GCHART procedure. PROC GCHART is invoked once, and uses run-group processing to generate four graphs and send them to catalog MYCAT. PROC GSLIDE produces a text slide containing the title and footnote for the combined graphs, and sends the output to the same catalog. Within PROC GREPLAY, the template is defined and panels 1 through 4 are evenly positioned on the graphics display area with sufficient space at the top and bottom to prevent them from overlapping the contents of panel 5. The height and width of these four panels must be reduced proportionally to avoid distortion of the charts when they are placed into the template. Figure 1 illustrates the template design. ------------------------------------------------------------------------- | | | PANEL 5 | | | | ---------------------------- ---------------------------- | | | | | | | | | PANEL 1 | | PANEL 2 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ---------------------------- ---------------------------- | | | | ---------------------------- ---------------------------- | | | | | | | | | PANEL 3 | | PANEL 4 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ---------------------------- ---------------------------- | | | | | ------------------------------------------------------------------------- Figure 1: Template Design The following program produces the graphs, defines a template, and replays the graphs in the template:
/* set GOPTIONS NODISPLAY if you don't want to see individual */
/* graphs while they are being created */
goptions reset=global htext=1.5 ftext=swissl nodisplay;
proc gchart data=sasuser.houses gout=mycat;
label price = 'Average Asking Price';
label baths = 'Average Number of Bathrooms';
axis1 label=none;
axis2 label=('Average Square Footage');
axis3 label=(angle=90 rotate=0)
order=0 to 100000 by 20000;
axis4 label=(angle=90 rotate=0);
/* chart for upper-left quadrant */
pie style / type=freq noheading slice=inside
value=outside percent=outside;
run;
/* chart for upper-right quadrant */
hbar style / type=mean sumvar=sqfeet
maxis=axis1 raxis=axis2 patternid=midpoint;
run;
/* chart for lower-left quadrant */
vbar bedrooms / group=style discrete nozeros type=mean
sumvar=baths raxis=axis4 gaxis=axis1
patternid=group;
run;
/* chart for lower-right quadrant */
vbar style / type=mean sumvar=price mean maxis=axis1
raxis=axis3 patternid=midpoint;
run;
quit;
/* generate title and footnote with PROC GSLIDE */
proc gslide gout=mycat;
title1 height=8 pct 'Housing Summary';
footnote1 height=4 pct 'Based on Style of Homes';
run;
quit;
/* set GOPTIONS DISPLAY before invoking */
/* PROC GREPLAY */
goptions display;
/* invoke GREPLAY and specify the input, output */
/* and template catalogs */
proc greplay nofs igout=mycat gout=mycat tc=mytemps;
/* define template panels */
tdef t2x2
/* upper-left panel */
1 / llx=6 ulx=6 urx=47 lrx=47
lly=48 uly=89 ury=89 lry=48
/* upper-right panel */
2 / llx=53 ulx=53 urx=94 lrx=94
lly=48 uly=89 ury=89 lry=48
/* lower-left panel */
3 / llx=6 ulx=6 urx=47 lrx=47
lly=7 uly=48 ury=48 lry=7
/* lower-right panel */
4 / llx=53 ulx=53 urx=94 lrx=94
lly=7 uly=48 ury=48 lry=7
/* full display panel for PROC GSLIDE output */
5 / llx=0 ulx=0 urx=100 lrx=100
lly=0 uly=100 ury=100 lry=0 ;
/* replay graphs into template panels */
template t2x2;
tplay 1:1 2:2 3:3 4:4 5:5;
run;
quit;
|