12-14-2012 01:12 AM
The default (and maybe only) way of sorting the 'groups' is alphabetical, ascending.
I have many panels (or screenfulls) of the resulting boxplots, though. And it's really difficult to ascertain which are higher.
I'd like to be able to sort the boxplots by another criteria other than alphabetical.
Like..., sort by the value of the highest observation.
Or..., sort by the value of the 75th percentile.
Does anyone know if such can be done? And how?
The more specific and detailed your suggestions, the better.
12-14-2012 09:10 AM
Here is a rather tedious way,but it does accomplish (I think) what you want:
*select the max of the variable you are interesting in plotting (the max of your Y-axis variable);
*and select the X-axis variable w/o any modifications;
*for my example I use age and height from sashelp.class -- not the best data set to use but to make the point;
*original plot - no modifications;
proc sort data = sashelp.class out = temp;by age;
proc boxplot data = temp;
plot height * age;
create table max_ht as
select max(height) as max_ht, age
group by age;
proc sort data = max_ht;by max_ht;run;
new_age = _n_; *we will eventually use this variable to create the box plots;
proc sort data = want;by age;
merge temp want;
proc sort data = really_want;by new_age;
proc boxplot data = really_want;
plot height * new_age;
Please let me know if you have questions.
(and provide sample data)
12-14-2012 06:18 PM
Thanks, Anca, for your work above.
At the very least you are corroborating that there is no simple way to change the default sort.