I'm trying to remove the months from the legend
title Hypoglycemia Rates
Keyledgend <bar image>Jan18 <bar image> Feb18 etc.... _____Target %3
and I just want something like this. I have attached my code
title Hypoglycemia Rates
Keyledgend <bar image> Compliance Rate _____Target %3
Please help. Thank you in advance. Mahalo, JB
proc sgplot data=merged2 dattrmap=dattrmap noautolegend ;
vbarparm category=month response=Pcnt_Resc_Meds_Admin /group=month groupdisplay=cluster
legendlabel='Compliance Rate' datalabel=Pcnt_Resc_Meds_Admin datalabelpos=data
datalabelattrs=(weight=bold size=10pt) attrid=xcolor
NOOUTLINE name='comp' ;
series x=month y=NonComp_Target /lineattrs=(color=red) datalabel=Pcnt_Resc_Meds_Admin
name='target' legendlabel='Compliance Target' ;
xaxis discreteorder=data display=(noline nolabel noticks);
yaxis label='% Noncompliance' values=(0. to 1.25 by .1)
labelattrs=(weight=bold) valueattrs=(size=10pt weight=bold);
keylegend 'comp' 'target' /noborder location=inside position=top
The legend for the VBARPARM by default want to display for each level of a group variable. Do you want a single bar or groups on the bar? If you different color values in your vbar results which single color would you want in legend? I would be very confused with a bar chart that showed different colors or such and then did not have key.
I suspect you want to remove the group=month from the vbarparm statement.
The users want the rolling months Jan-Dec a blue color and the total bar an orange color. That is why I have the group on month.
If I remove the group all the bars will be the same color.
What version of SAS do you have?
It's actually Enterprise Guide 7.13 HF3 64bit
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.