Sample 45147: Use PROC GREPLAY to place four graphs on a single page in an RTF document
The sample code on the
Full Code tab first uses four PROC GCHART steps to write four graphs to the default graphics catalog of WORK.GSEG. In a final step, the GREPLAY procedure together with the ODS RTF statement are used to write the four GCHART graphs to a single page in the RTF document.
The GREPLAY procedure step uses the L2R2 template to arrange the graphs on the page with two graphs across the page and two graphs down the page.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The sample code below uses the PNG300 device driver, which is new beginning with SAS® 9.2. To run this sample code with releases of SAS prior to 9.2, replace the PNG300 device driver with the PNG device driver in both of the GOPTIONS statements in the code.
/* Delete any old graphs that exist in the */
/* default graphics catalog of WORK.GSEG. */
%macro delcat(catname);
%if %sysfunc(cexist(&catname)) %then %do;
proc greplay nofs igout=&catname;
delete _all_;
run;
quit;
%end;
%mend delcat;
%delcat(work.gseg)
options nodate nonumber orientation=landscape;
/* Create the individual graphs. */
goptions reset=all device=PNG300 nodisplay
hsize=5in vsize=3.75in;
axis1 minor=none order=(0 to 150 by 25)
label=(angle=90 'Average Weight');
title1 h=12pt 'Average Weight for Females';
proc gchart data=sashelp.class;
where sex="F";
vbar age / sumvar=weight type=mean subgroup=age
nolegend discrete width=9
raxis=axis1;
run;
quit;
title1 h=12pt 'Average Weight for Males';
proc gchart data=sashelp.class;
where sex="M";
vbar age / sumvar=weight type=mean subgroup=age
nolegend discrete width=9
raxis=axis1;
run;
quit;
axis1 minor=none order=(0 to 80 by 20)
label=(angle=90 'Average Height');
title1 h=12pt 'Average Height for Females';
proc gchart data=sashelp.class;
where sex="F";
vbar age / sumvar=height type=mean subgroup=age
nolegend discrete width=9
raxis=axis1;
run;
quit;
title1 h=12pt 'Average Height for Males';
proc gchart data=sashelp.class;
where sex="M";
vbar age / sumvar=height type=mean subgroup=age
nolegend discrete width=9
raxis=axis1;
run;
quit;
/* Use these GOPTIONS for the GREPLAY procedure step */
goptions reset=all device=PNG300
hsize=10in vsize=7in;
/* Use PROC GREPLAY together with the ODS RTF statement */
/* to display the four graphs created above on a single */
/* page in the RTF document. */
ods listing close;
ods rtf file='g45147.rtf';
proc greplay igout=work.gseg nofs
tc=sashelp.templt template=l2r2;
treplay 1:1 2:3 3:2 4:4;
run;
quit;
ods rtf close;
ods listing;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample illustrates how to use PROC GREPLAY to put four graphs on a single page in an RTF document.
Date Modified: | 2012-02-06 16:09:05 |
Date Created: | 2011-12-14 16:07:21 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |
Windows Vista | 9.1 TS1M3 SP4 | |
Windows Vista for x64 | 9.1 TS1M3 SP4 | |
64-bit Enabled AIX | 9.1 TS1M3 SP4 | |
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |
HP-UX IPF | 9.1 TS1M3 SP4 | |
Linux | 9.1 TS1M3 SP4 | |
Linux on Itanium | 9.1 TS1M3 SP4 | |
OpenVMS Alpha | 9.1 TS1M3 SP4 | |
Solaris for x64 | 9.1 TS1M3 SP4 | |
Tru64 UNIX | 9.1 TS1M3 SP4 | |