Sample 24888: Add and label reference lines using annotate
/* The Annotate facility is used to draw reference */
/* lines on a vertical bar chart created with PROC */
/* GCHART. */
/* Set graphics options */
goptions reset=all border;
/* Create input data set, A */
data a;
input year y;
datalines;
90 40
91 85
92 80
93 50
94 90
95 80
;
/* Create the Annotate data set, B */
data b;
length color function $8 text $14;
retain xsys '1' ysys '2' when 'a';
function='move'; x=0; y=60; output;
function='draw'; x=100; y=60; color='red'; size=2; output;
function='label'; x=50; y=60; size=1; position='2'; color='black'; text='Goal=60'; output;
function='move'; x=0; y=70.83; output;
function='draw'; x=100; y=70.83; color='green'; size=2; output;
function='label'; x=50; y=70.83; size=1; position='2'; color='black'; text='Avg.=70.83'; output;
run;
/* Define patterns for the bars */
pattern v=s c=yellow;
/* Define axis characteristics */
axis1 order=(0 to 100 by 25);
/* Produce the bar chart */
proc gchart data=a;
vbar year/ anno=b sumvar=y raxis=axis1 discrete;
/* Add the title */
title1 h=5 pct 'Sales Report';
run;
quit;

The Annotate facility is used to draw and label reference
lines on a vertical bar chart created with PROC GCHART.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GCHART Query and Reporting ==> Creating Reports ==> Graphical ==> Graph Elements ==> Reference Lines
|
| 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 |