Sample 24886: Annotate value above each midpoint bar
/******************************************************/
/* If you request the statistic to print above each */
/* bar, SAS may produce a message in the log stating */
/* that the values are wider than the bars. If this */
/* happens, you can use the ANNOTATE Facility to */
/* circumvent the problem. */
/******************************************************/
/* Set graphics options */
goptions reset=all border ftext=swiss;
/* Create input data set, SOLD */
data sold;
input city $ sales comma7.;
datalines;
Atlanta 200,175
Chicago 425,500
Seattle 308,110
;
/* 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 '2' size 3 hsys '3';
set sold;
midpoint=city;
text=left(put(sales,dollar8.));
y=sales;
run;
/* Define patterns for the bars */
pattern1 v=s c=blue;
pattern2 v=s c=green;
pattern3 v=s c=red;
/* Add a title */
title 'Sales Report';
/* Produce the bar chart */
proc gchart data=sold;
vbar city / sumvar=sales nozero anno=anno;
format sales dollar8.;
run;
quit;

If you request the statistic to print above each bar, SAS may produce a message in the log stating that the values are wider than the bars. If this happens, you can use the ANNOTATE Facility to circumvent the problem.
| 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 |