Sample 24887: Annotate values for each subgroup bar
/**************************************************************/
/* The INSIDE/OUTSIDE options can be specified on the */
/* VBAR/VBAR3D statement in order to automatically display */
/* the percentage value within each subgroup. For example: */
/* INSIDE=SUBPCT displays the percent contribution value */
/* within each subgroup. If you want to control the font, */
/* height, or color of these values you will need to use */
/* Annotate to accomplish this. This example explains how to */
/* do this. */
/**************************************************************/
/* Set graphics options */
goptions reset=all border;
/* Create input data set, SOLD */
data sold;
input city $ sales comma7. type $;
datalines;
Atlanta 200,175 Inside
Atlanta 100,100 Outside
Chicago 425,500 Inside
Chicago 322,010 Outside
Seattle 308,110 Inside
Seattle 100,355 Outside
;
/* Create the Annotate data set, ANNO */
data anno;
length function color style text $ 8;
retain function 'label' color 'black' when 'a' style 'swiss'
xsys ysys '2' position 'E' size 2 hsys '3';
set sold;
midpoint=city;
subgroup=type;
text=left(put(sales,dollar8.));
run;
/* Define patterns for the bars */
pattern1 v=s c=green;
pattern2 v=s c=yellow;
/* Define axis characteristics */
axis1 minor=none;
/* Add the title */
title 'Sales Report';
/* Produce the bar chart */
proc gchart data=sold;
vbar city / sumvar=sales raxis=axis1
nozero anno=anno subgroup=type;
format sales dollar8.;
run;
quit;

The INSIDE/OUTSIDE options can be specified on the VBAR/VBAR3D statement in order to automatically display the percentage value within each subgroup.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Labels
|
| Date Modified: | 2005-08-24 16:06:29 |
| Date Created: | 2004-11-11 11:07:55 |
Operating System and Release Information
| SAS System | SAS/GRAPH | All | n/a | n/a |