Note that one GOPTIONS statement is used before the first PROC GCHART step while a second GOPTIONS statement is used before the PROC GREPLAY step.
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 first uses four PROC GCHART steps to write four individual graphs to the default graphics catalog of WORK.GSEG. At the end of the code, the L2R2 template is used with PROC GREPLAY together with the ODS PDF statement to create a single-page PDF file with four graphs on the same page.
Note that one GOPTIONS statement is used before the first PROC GCHART step while a second GOPTIONS statement is used before the PROC GREPLAY step.
The graphics output on the Results tab was produced using SAS® 9.2. Submitting the sample code with releases of SAS prior to SAS 9.2 might produce different results.
/* Delete any graphs that exist in the */
/* default graphics catalog 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;
/* Create the individual graphs. */
goptions reset=all device=sasprtc nodisplay
hsize=4.25in vsize=5.5in;
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=5
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=5
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=5
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=5
raxis=axis1;
run;
quit;
/* Create the combined graph. */
goptions reset=all device=sasprtc;
ods listing close;
ods pdf file='greplay.pdf' dpi=300 notoc;
proc greplay igout=work.gseg nofs
tc=sashelp.templt template=l2r2;
treplay 1:1 2:3 3:2 4:4;
run;
quit;
ods pdf 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 code produces PDF output.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GREPLAY |
Date Modified: | 2011-11-30 13:45:32 |
Date Created: | 2011-11-23 15:56:13 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |||
Microsoft Windows XP 64-bit Edition | 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 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |||
z/OS | 9.1 TS1M3 SP4 | |||
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 |