Sample 42660: Display dual axes on a bar chart using the Graph Template Language
This sample illustrates how to display dual axes on a bar chart with the Graph Template Language (GTL).
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 display dual axes on a bar chart with the Graph Template Language (GTL).
/* Create a format for the X2 axis */
proc format;
picture per
other='009%' ;
run;
/* Create a dummy variable that contains a value of zero */
data test;
input group $ Answer $ Measure;
dummyval=0;
format dummyval per.;
datalines;
A Yes 5
A No 10
B Yes 8
B No 20
;
run;
/* Set the OFFSETMIN and OFFSETMAX options for both response */
/* axes to be zero so that the axes values align. */
proc template;
define statgraph test;
begingraph;
entrytitle 'Bar chart with 2 response axis scales';
layout overlay / x2axisopts=(linearopts=(viewmin=0 viewmax=100
tickvaluesequence=(start=0 end=100 increment=10))
offsetmin=0 offsetmax=0 display=(tickvalues line ticks ))
xaxisopts=(offsetmin=0 offsetmax=0);
barchart x=Answer y=dummyval/group=group xaxis=x2 orient=horizontal;
barchart x=Answer y=Measure /group=group xaxis=x orient=horizontal;
endlayout;
endgraph;
end;
run;
ods listing close;
ods html image_dpi=100 file='dualaxes.html' path='.';
ods graphics / reset noborder width=600px height=400px;
proc sgrender data=test template=test;
run;
ods html 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 display dual axes on a bar chart with the Graph Template Language (GTL).
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGRENDER Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Template Language (GTL)
|
Date Modified: | 2011-07-15 14:29:38 |
Date Created: | 2011-03-10 16:30:22 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Windows Vista for x64 | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |