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!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 1250 views
  • 5 likes
  • 3 in conversation