The sample code on the Full Code tab illustrates how to create a subgrouped vertical bar chart with the GCHART procedure in which the subgroups for each midpoint total 100%.
To accomplish this, the GROUP= option is specified with the chart variable. The G100 option is used to calculate the percentage statistics separately for each group (midpoint). The options on the AXIS1 statement suppress the label and values for the group axis.
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.
To accomplish this, the GROUP= option is specified with the chart variable. The G100 option is used to calculate the percentage statistics separately for each group (midpoint). The options on the AXIS1 statement suppress the label and values for the group axis.
The graphics output in 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.
/* Set the graphics environment */
goptions reset=all cback=white border htitle=12pt htext=10pt;
/* Create sample data */
data test;
input midpnt category $ count;
datalines;
1 cat1 60
1 cat2 40
2 cat1 30
2 cat2 70
3 cat1 80
3 cat2 20
;
run;
/* Define a title for the graph */
title1 'Subgroups for Each Midpoint Total 100%';
/* Suppress the group axis label and values */
axis1 label=none value=none;
/* Angle the label for the response axis */
axis2 label=(angle=90 'Percent');
/* Define legend characteristics */
legend1 label=('Category') frame;
proc gchart data=test;
vbar midpnt / discrete subgroup=category
group=midpnt g100 nozero
freq=count type=percent
inside=percent width=20
gaxis=axis1 raxis=axis2
legend=legend1;
run;
quit;
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.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Bar |
Date Modified: | 2011-03-04 11:01:25 |
Date Created: | 2010-12-28 03:36:02 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | Windows Vista for x64 | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |||
Microsoft Windows XP Professional | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |||
Microsoft® Windows® for x64 | 9.2 TS1M0 | |||
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |||
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |||
z/OS | 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 |