Sample 25504: Label subgroups in a vertical bar chart using PROC GCHART
The sample code on the Full Code tab shows how to label subgroups in a vertical bar chart using the Annotate facility.
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 shows how to label subgroups in a vertical bar chart using the Annotate facility.
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.
goptions border htext=11pt;
/* Create data set of units sold */
data sold;
length type $ 10;
input city $ units type $ ;
datalines;
Atlanta 99 Printers
Atlanta 105 Plotters
Atlanta 85 Terminals
Paris 182 Printers
Paris 150 Plotters
Paris 157 Terminals
Sydney 111 Printers
Sydney 136 Plotters
Sydney 100 Terminals
;
run;
/* Create the Annotate data set, BARLABEL */
data barlabel;
length color $ 8;
retain color 'black' when 'a'
xsys ysys '2' position 'E';
set sold;
midpoint=city;
subgroup=type;
text=left(put(units,5.));
run;
title h=12pt 'Orders Received';
/* Define axis characteristics */
axis1 label=none major=none minor=none style=0
value=none;
axis2 label=none;
/* Generate vertical bar chart */
/* using the Annotate data set */
proc gchart data=sold;
vbar city / type=sum
sumvar=units
subgroup=type
width=17
raxis=axis1
maxis=axis2
annotate=barlabel
noframe;
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 shows how to label subgroups in a vertical bar chart using the Annotate facility.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Types ==> Charts ==> Bar
|
Date Modified: | 2005-07-20 03:02:43 |
Date Created: | 2005-05-23 14:11:52 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.1 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M0 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M0 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M0 | |
Microsoft Windows 2000 Server | 9.1 TS1M0 | |
Microsoft Windows 2000 Professional | 9.1 TS1M0 | |
Microsoft Windows NT Workstation | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M0 | |
Microsoft Windows XP Professional | 9.1 TS1M0 | |
64-bit Enabled AIX | 9.1 TS1M0 | |
64-bit Enabled HP-UX | 9.1 TS1M0 | |
64-bit Enabled Solaris | 9.1 TS1M0 | |
HP-UX IPF | 9.1 TS1M0 | |
Linux | 9.1 TS1M0 | |
OpenVMS Alpha | 9.1 TS1M0 | |
Tru64 UNIX | 9.1 TS1M0 | |