1
votes

Suppose I have sgplot and my output looks something likeenter image description here

My aim is to adjust the legend and make the bottom section to look something like below. How can I do this? enter image description here

1
What version of SAS do you have? I think this is only possible in SAS 9.4. - Reeza
yes I have SAS 9.4 - Lester
So I know its possible but not how. I'm pretty sure it was on the SAS blog. I do know that if you don't get an answer here post it to communities.sas.com and one of the SAS developers will help. - Reeza
thank you, Joe's answer works well. - Lester
Joe is definitely a better programmer than me ;) - Reeza

1 Answers

3
votes

In 9.4 you can use XAXISTABLE to get to what you want. I found that it was easiest to do all of the labelling with XAXISTABLE and abandon the entire XAXIS label.

proc sgplot data=sashelp.class noautolegend;
  vbox height/category=age group=sex grouporder=ascending;
  xaxis label='' display=NONE;
  xaxistable sex/location=outside label=' ' colorgroup=sex class=sex classdisplay=cluster classorder=ascending;
  xaxistable age/location=outside label=' ' stat=mean;    
run;

In a previous version it's possible using either annotation or a scatterplot, though the latter won't be perfectly identical to what you want.