BookmarkSubscribeRSS Feed
MicrosimBen
Calcite | Level 5

I have index scores small area data and am calculating higher area based box plots using this data. When I chart my data it is arranged in alphabetical order. I want the higher level areas ordered by their box plot average (mean_all). I have SAS 7.1 and 'CATEGORYORDER=RESPASC' appears to do nothing? Am I doing something wrong - are there any suggestions? I have a total of 150 areas I'm doing box plots for so not sure formatting is something I would want to do with this many areas. I want them ordered from highest to smallest number for 'mean_all'. The required input file is included here as suburb_scores.

 

Thanks

Ben

 

proc sgplot data=finalresult_2 dattrmap=attrmap noborder;
hbox pca_all /  category=ced lineattrs=(pattern=solid) whiskerattrs=(pattern=solid) whiskerpct=0
meanattrs=(color=black symbol=Plus) medianattrs=(color=black ) attrid=myid  CATEGORYORDER=RESPASC;
by gcc2;
yaxistable mean_all / location=inside valueattrs=(size=6)  separator labelattrs=(size=6) stat=mean ;

3 REPLIES 3
FreelanceReinh
Jade | Level 19

Hi @MicrosimBen and welcome to the SAS Support Communities!

 

Instead of CATEGORYORDER= use a YAXIS statement (in the PROC SGPLOT step) with the DISCRETEORDER= option:

yaxis discreteorder=data;

As a preliminary step, you need to sort the input dataset (or create a sorted view) by descending mean_all within the BY groups so that discreteorder=data leads to the intended sort order:

proc sort data=finalresult_2;
by gcc2 descending mean_all;
run; 

 

iksawffej
Fluorite | Level 6

You are my sunshine, my only sunshine! Tks!

MicrosimBen
Calcite | Level 5

Thanks a lot that's fantastic!

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
  • 3 replies
  • 2655 views
  • 5 likes
  • 3 in conversation