Sample 24945: Replay graphs with a shared title and legend
/****************************************************************************/
/* The purpose of this program is to replay 4 gplots into a template with a */
/* shared/common title and legend. */
/****************************************************************************/
goptions reset=all ftext='Times New Roman' htext=4;
/* Delete GRSEG entries from GSEG catalog, Optional*/
proc greplay nofs igout=work.gseg;
delete _all_;
run;
quit;
data one;
do grp=1 to 4;
do z='a','b','c';
do x=0 to 10;
y=ranuni(0)*10;
output;
end;
end;
end;
run;
/* Sort by By-group and category variable */
proc sort;
by grp z;
run;
/* Specify SYMBOL statements to be used by GPLOT procedures */
symbol1 v=dot c=black i=join h=2;
symbol2 v=star c=black i=join h=2;
symbol3 v=square c=black i=join h=2;
/* Specify AXIS statements to be used by GPLOT procedures */
axis1 order=(0 to 10 by 2) offset=(2,2)pct;
axis2 order=(0 to 10 by 1) offset=(2,2)pct;
/* Turn DISPLAY off */
goptions nodisplay;
/* Use BY-GROUP statement to produce multiple GPLOTS */
proc gplot;
plot y*x=z/vaxis=axis1 haxis=axis2 nolegend frame;
by grp;
run;
quit;
/* Specify an ORDER so that all observations will be out of range */
axis3 order=(-99 to -90 by 1);
/* Specify LEGEND statement to be used by the following GPLOT */
legend1 label=(h=2 'Shared Legend') value=(h=2) shape=symbol(7,1);
/* Produce GPLOT that generates a LEGEND with suppressed axes */
proc gplot;
plot y*x=z/vaxis=axis3 haxis=axis3 noaxes legend=legend1 noframe;
run;
quit;
/* Create a Common shared title */
proc gslide;
title1 h=2 'This is the Shared Title';
run;
quit;
/* Turn DISPLAY on */
goptions display;
/* Create 5 panel template. */
/* Replay entries into panels. */
proc greplay nofs igout=work.gseg tc=tempcat;
tdef spec des='five panel template'
1/ llx=1 lly=50
ulx=1 uly=90
urx=50 ury=90
lrx=50 lry=50
2/ llx=50 lly=50
ulx=50 uly=90
urx=99 ury=90
lrx=99 lry=50
3/ llx=1 lly=10
ulx=1 uly=50
urx=50 ury=50
lrx=50 lry=10
4/ llx=50 lly=10
ulx=50 uly=50
urx=99 ury=50
lrx=99 lry=10
5/ llx=0 lly=0
ulx=0 uly=100
urx=100 ury=100
lrx=100 lry=0
;
template spec;
treplay 1:gplot 2:gplot1 3:gplot2 4:gplot3 5:gplot4 5:gslide;
run;
quit;

This sample program replays multiple graphs to a page with a shared title and legend.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GREPLAY
|
| Date Modified: | 2005-09-01 03:03:08 |
| Date Created: | 2004-11-11 11:08:05 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | n/a | n/a |