BookmarkSubscribeRSS Feed
ramtejdasari
Calcite | Level 5

Hi , I am creating waterfall plot and a bar chart in one panel ,  where in both the plots the treatments are same for the legend. I don't want to duplicate the same treatments for the two plots in the legend. How can i suppress or exclude the duplicate treatments from the legend.  I am using below code to create the plots. Attached is the plot for reference

 

 

proc sgplot data=fin nowall noborder nocycleattrs;
format trtpn arm.;
styleattrs datacolors=(blue yellow green red purple) datacontrastcolors=(blue yellow green red purple) axisextent=data;
symbolchar name=mystar char='002a'x / voffset= -0.5 scale=7;
vbarparm category=usubjid response=chgsld / group=trtpn datalabel=chgsld dataskin=pressed
datalabelattrs=(size=8 weight=bold) clusterwidth=1;
vbarparm category=usubjid response=chgbm / group=trtpn datalabel=chgbm y2axis dataskin=pressed
/*fillattrs=(color= cxcfcf7f)*/;
scatter x=usubjid y=CRR / markerattrs=(symbol=mystar color= green size=3);
/* refline 20 -30 / lineattrs=(pattern=shortdash);*/
xaxis display=none colorbands=odd colorbandsattrs=(transparency=0.6);
yaxis label="Change from baseline in Total SLEDAI score" values=(40 to -40 by -10) offsetmax=0.55 labelpos=datacenter offsetmin=0;
y2axis label="Change from baseline in Biomarker" values=(90 to -90 by -15) offsetmin=0.5 offsetmax=0.02 labelpos=datacenter;
keylegend / exclude=("Change from Baseline") title='' border;
run;

1 REPLY 1
Reeza
Super User

Maybe give the plots that you want to include in the legend a name and then only include those in the key legend instead?

 

FYI - this is a case where formatting the code for legibility really helps. Your exclude statement confuses me as there's no other reference to that item in the code.....

 


@ramtejdasari wrote:

Hi , I am creating waterfall plot and a bar chart in one panel ,  where in both the plots the treatments are same for the legend. I don't want to duplicate the same treatments for the two plots in the legend. How can i suppress or exclude the duplicate treatments from the legend.  I am using below code to create the plots. Attached is the plot for reference

 

 

proc sgplot data=fin nowall noborder nocycleattrs;
format trtpn arm.;
styleattrs datacolors=(blue yellow green red purple) datacontrastcolors=(blue yellow green red purple) axisextent=data;
symbolchar name=mystar char='002a'x / voffset= -0.5 scale=7;
vbarparm category=usubjid response=chgsld / group=trtpn datalabel=chgsld dataskin=pressed
datalabelattrs=(size=8 weight=bold) clusterwidth=1;
vbarparm category=usubjid response=chgbm / group=trtpn datalabel=chgbm y2axis dataskin=pressed
/*fillattrs=(color= cxcfcf7f)*/;
scatter x=usubjid y=CRR / markerattrs=(symbol=mystar color= green size=3);
/* refline 20 -30 / lineattrs=(pattern=shortdash);*/
xaxis display=none colorbands=odd colorbandsattrs=(transparency=0.6);
yaxis label="Change from baseline in Total SLEDAI score" values=(40 to -40 by -10) offsetmax=0.55 labelpos=datacenter offsetmin=0;
y2axis label="Change from baseline in Biomarker" values=(90 to -90 by -15) offsetmin=0.5 offsetmax=0.02 labelpos=datacenter;
keylegend / exclude=("Change from Baseline") title='' border;
run;


 

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
  • 1 reply
  • 1204 views
  • 0 likes
  • 2 in conversation