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.
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;
yaxistable mean_all / location=inside valueattrs=(size=6) separator labelattrs=(size=6) stat=mean ;
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:
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;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.