Sample 25504: Label subgroups in a vertical bar chart using PROC GCHART
This sample 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: | Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Labels 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 | All | 8 TS M0 | n/a |