I am having difficulty adding significance letters to the tops of the bars in Proc sgplot. I have error bars shown too and everything I've read says I can't have both error bars and letter. Is this true? The letters appear on the graph but not where I'd like them to be. Here's my code and data attached:
Proc sgplot data=LSMSPwk1interact noborder;
vbarparm category=Treatment response=Estimate / limitlower=limitlower limitupper=limitupper limitattrs=(color=black Thickness=1.75)
group=Foragetype groupdisplay=cluster fill barwidth=0.85 datalabel=Sigletter datalabelpos=top
datalabelattrs=(color=black Family="Times New Roman" Size=12);
styleattrs datacolors=(dagrybr bgr grybr);
xaxis Label= 'Treatment' labelattrs=(color=black Family="Times New Roman" Size=12) valueattrs=(color=black Family="Times New Roman" Size=12);
yaxis min=-2 max=100 grid Label= 'Proportion (%)' labelattrs=(color=black Family="Times New Roman" Size=12)
valueattrs=(color=black Family="Times New Roman" Size=12);
keylegend / title="" position=top noborder valueattrs=(color=black Family="Times New Roman" Size=12)
titleattrs=(color=black Family="Times New Roman" Size=12);
Run;
Try using a TEXT statement instead of datalabel and provide the x/y location.
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n0lprj1bdrlrkgn1vmqnd7r6fnry.htm
@mcknigh3 wrote:
I am having difficulty adding significance letters to the tops of the bars in Proc sgplot. I have error bars shown too and everything I've read says I can't have both error bars and letter. Is this true? The letters appear on the graph but not where I'd like them to be. Here's my code and data attached:
Proc sgplot data=LSMSPwk1interact noborder;
vbarparm category=Treatment response=Estimate / limitlower=limitlower limitupper=limitupper limitattrs=(color=black Thickness=1.75)
group=Foragetype groupdisplay=cluster fill barwidth=0.85 datalabel=Sigletter datalabelpos=top
datalabelattrs=(color=black Family="Times New Roman" Size=12);
styleattrs datacolors=(dagrybr bgr grybr);
xaxis Label= 'Treatment' labelattrs=(color=black Family="Times New Roman" Size=12) valueattrs=(color=black Family="Times New Roman" Size=12);
yaxis min=-2 max=100 grid Label= 'Proportion (%)' labelattrs=(color=black Family="Times New Roman" Size=12)
valueattrs=(color=black Family="Times New Roman" Size=12);
keylegend / title="" position=top noborder valueattrs=(color=black Family="Times New Roman" Size=12)
titleattrs=(color=black Family="Times New Roman" Size=12);
Run;
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.