Sample 25504: Labeling subgroups in a vertical bar chart using PROC GCHART
This sample is from the "SAS/GRAPH Software: Reference, Version 8", Volume 1, Chapter 10.
For additional information on the sample refer to this book.
/*+-------------------------------------------------------------+
| S A S S A M P L E L I B R A R Y |
| |
| NAME: GANVBAR |
| TITLE: GANVBAR-Labeling Subgroups in a Vertical Bar Chart |
| PRODUCT: GRAPH |
| SYSTEM: ALL |
| KEYS: GRAPHICS AXIS ANNOTATE GCHART |
| PROCS: GCHART |
| DATA: INTERNAL |
| |
| SUPPORT: GRAPHICS STAFF UPDATE: |
| REF: SAS/GRAPH REFERENCE GUIDE |
| MISC: |
| |
+-------------------------------------------------------------+*/
/* Set the graphics environment */
goptions reset=all gunit=pct border cback=white
colors=(blue green red) ctext=black
htitle=6 ftitle=swissb htext=4 ftext=swiss;
/* 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
;
/* Create the Annotate data set, BARLABEL */
data barlabel;
length color style $ 8;
retain color 'white' when 'a' style 'swissb'
xsys ysys '2' position 'E' size 4 hsys '3';
set sold;
midpoint=city;
subgroup=type;
text=left(put(units,5.));
run;
/* Define the title and footnote */
title 'Orders Received';
footnote h=3 j=r 'GANVBAR';
/* 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;

This example 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 |