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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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