Hello SAS-users.
I have no experience with annotate datasets. I'm trying to use annotate at first time.
I build a graph using Gchart procedure. See part 1 of the code below.
Now I need to add two lines at the same graph. I have tried to draw these lines by using annotate dataset.
See part 2 of the code below.
There are no errors in the Log. But the lines are not visualising in the output window.
What am I doing wrong?
Please help.
Oleg.
[pre]
/* Code part 1 */
/* input dataset for proc gchart */
data inp;
infile cards dlm=',';
informat date date9. cbmb11 $2. pct percent8.;
format date mmddyy10. pct percentn8.2;
input date cbmb11 pct ;
cards;
31DEC2009,CB, 0.00%
31DEC2009,MB, 0.00%
31JAN2010,CB, 1.87%
31JAN2010,MB, 3.31%
28FEB2010,CB, 2.09%
28FEB2010,MB, 0.05%
31MAR2010,CB, 2.01%
31MAR2010,MB, 0.81%
;
goptions reset=all;
title1 "Dynamic (%)" ;
axis1 color=black width=3 label=(color=black height=0.75 "%") minor=(number=1) value=(height=0.75) order=(0 to 0.07 by 0.01);
axis2 color=black width=3 label=(color=black height=0.75 "Date") value=(height=0.75);
goptions device=win cback=white ftext="Arial" htitle=1;
pattern1 color=blue value=r3 r=1;
pattern2 color=green value=l1 r=1;
/* Gchart proc. without annotate */
proc gchart data=inp ;
vbar cbmb11 / sumvar=pct width=8 group=date discrete gaxis=axis2 axis=axis1 frame sum patternid=midpoint space=0 ;
run;
quit;
/* Code part 2 */
/* Annotate dataset */
data an;
infile cards dlm=',';
informat xsys $1. ysys $1. hsys $1. function $8. color $8. group date9. x date9. y percent8. line 8. size 8.;
format group x mmddyy10. y percentn8.2;
input xsys ysys hsys function color group x y line size;
cards;
2,2,1 ,move , ,31DEC2009,31DEC2009, 0.00% , ., .
2,2,1 ,draw ,blue ,31JAN2010,31JAN2010, 1.87% , 2, 20
2,2,1 ,move , ,31JAN2010,31JAN2010, 1.87% , ., .
2,2,1 ,draw ,blue ,28FEB2010,28FEB2010, 4.00% , 2, 20
2,2,1 ,move , ,28FEB2010,28FEB2010, 4.00% , ., .
2,2,1 ,draw ,blue ,31MAR2010,31MAR2010, 6.09% , 2, 20
2,2,1 ,move , ,31MAR2010,31MAR2010, 6.09% , ., .
2,2,1 ,draw ,blue ,31MAR2010,31MAR2010, 6.09% , 2, 20
2,2,1 ,move , ,31DEC2009,31DEC2009, 0.00% , ., .
2,2,1 ,draw ,green ,31JAN2010,31JAN2010, 3.31% , 1, 5
2,2,1 ,move , ,31JAN2010,31JAN2010, 3.31% , ., .
2,2,1 ,draw ,green ,28FEB2010,28FEB2010, 3.37% , 1, 5
2,2,1 ,move , ,28FEB2010,28FEB2010, 3.37% , ., .
2,2,1 ,draw ,green ,31MAR2010,31MAR2010, 4.20% , 1, 5
2,2,1 ,move , ,31MAR2010,31MAR2010, 4.20% , ., .
2,2,1 ,draw ,green ,31MAR2010,31MAR2010, 4.20% , 1, 5
;
/* Gchart proc. with annotate */
proc gchart data=inp ;
vbar cbmb11 / sumvar=pct width=8 group=date discrete gaxis=axis2 axis=axis1
frame sum patternid=midpoint space=0 annotate=an ;
run;
quit;
[/pre]