Sample 45124: Display multiple groups on the midpoint axis with PROC GCHART
The sample code on the
Full Code tab illustrates how to use the Annotate facility with PROC GCHART to display multiple groups on the midpoint 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.
The sample code below illustrates how to use the Annotate facility with PROC GCHART to display multiple groups on the midpoint axis.
/* Set the graphics environment */
goptions reset=all border cback=white htitle=12pt htext=10pt;
/* Create data set Test */
data test;
set sashelp.shoes;
where region in ("Asia", "Pacific") and product in ("Boot", "Sandal" "Slipper");
new=trim(region)||product;
run;
/* Create an Annotate data set to label the Asia and Pacific groups */
data anno;
length function color $8 text $7;
retain function 'label' xsys '2' ysys '3' color 'black' when 'a';
set test;
midpoint=new;
group=product;
if substr(new,1,4)='Asia' then do;
y=7.5;
text='Asia';
output;
end;
if substr(new,1,7)='Pacific' then do;
y=7.5;
text='Pacific';
output;
end;
run;
/* Define the title for the chart */
title1 'Display Multiple Groups on the Midpoint Axis';
/* Specify a blank value for the axis label */
axis1 label=(h=1 ' ') value=none;
/* Generate the bar chart */
proc gchart data=test;
vbar new / sumvar=sales group=product patternid=midpoint
maxis=axis1 nozero annotate=anno width=10;
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.
This sample illustrates how to use the Annotate facility with PROC GCHART to display multiple groups on the midpoint axis.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Annotation
|
Date Modified: | 2012-02-09 11:35:47 |
Date Created: | 2011-12-12 16:53:59 |
Operating System and Release Information
SAS System | SAS/GRAPH | Solaris for x64 | 9.2 TS2M3 | |
z/OS | 9.2 TS2M3 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M3 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M3 | |
Windows 7 Enterprise 32 bit | 9.2 TS2M3 | |
Microsoft® Windows® for x64 | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M3 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M3 | |
Microsoft Windows Server 2003 for x64 | 9.2 TS2M3 | |
Microsoft Windows Server 2008 | 9.2 TS2M3 | |
Microsoft Windows Server 2008 for x64 | 9.2 TS2M3 | |
Microsoft Windows XP Professional | 9.2 TS2M3 | |
Windows 7 Enterprise x64 | 9.2 TS2M3 | |
Windows 7 Home Premium 32 bit | 9.2 TS2M3 | |
Windows 7 Home Premium x64 | 9.2 TS2M3 | |
Windows 7 Professional 32 bit | 9.2 TS2M3 | |
Windows 7 Professional x64 | 9.2 TS2M3 | |
Windows 7 Ultimate 32 bit | 9.2 TS2M3 | |
Windows 7 Ultimate x64 | 9.2 TS2M3 | |
Windows Vista | 9.2 TS2M3 | |
Windows Vista for x64 | 9.2 TS2M3 | |
64-bit Enabled AIX | 9.2 TS2M3 | |
64-bit Enabled HP-UX | 9.2 TS2M3 | |
64-bit Enabled Solaris | 9.2 TS2M3 | |
HP-UX IPF | 9.2 TS2M3 | |
Linux | 9.2 TS2M3 | |
Linux for x64 | 9.2 TS2M3 | |
OpenVMS on HP Integrity | 9.2 TS2M3 | |