BookmarkSubscribeRSS Feed
JBrew
Calcite | Level 5

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

 

 

4 REPLIES 4
ballardw
Super User

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.

JBrew
Calcite | Level 5

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.

DanH_sas
SAS Super FREQ

What version of SAS do you have?

 

JBrew
Calcite | Level 5

It's actually Enterprise Guide 7.13 HF3 64bit

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1690 views
  • 0 likes
  • 3 in conversation