data a;
input obs Length species$@@;
drop obs;
cards;
1 22 1
2 23.9 1
3 20.9 1
4 23.8 1
27 22 2
28 22.1 2
29 21.1 2
30 23 2
31 19.8 3
32 22.1 3
33 21.5 3
;
run;
proc print data=a;
run;
proc anova data=a;
class species;
model Length=species;
means species/tukey;
run;
proc means mean std data=a noprint;
by species;
output out=b mean=mean std=std;
run;
data anno;
length color function $8;
retain xsys ysys '2' hsys '4' when 'a' color 'red' size 1;
set b;
/* Lower tick */
function='move'; xsys='2'; ysys='2'; midpoint=species; y=mean-std; output;
function='draw'; xsys='7'; ysys='2'; x=-2; y=mean-std; output;
function='draw'; xsys='7'; ysys='2'; x=+4; y=mean-std; output;
/* Upper tick */
function='move'; xsys='2'; ysys='2'; midpoint=species; y=mean+std; output;
function='draw'; xsys='7'; ysys='2'; x=-2; y=mean+std; output;
function='draw'; xsys='7'; ysys='2'; x=+4; y=mean+std; output;
/* Join upper and lower */
function='move'; xsys='2'; ysys='2'; midpoint=species; y=mean-std; output;
function='draw'; xsys='2'; ysys='2'; midpoint=species; y=mean+std; output;
run;
pattern1 v=empty c=blue;
axis1 order=(0 to 30 by 2);
title1 ' One Std of Mean';
proc gchart data=a;
vbar species/ anno=anno raxis=axis1 type=mean sumvar=Length;
run;
quit;