02-22-2017 01:30 PM
I ran a PROC ANOVA and my box plot is coming out with the three age groups I used in the analysis, but the age group that should be "first" which includes the youngest patients is in the middle instead of on the far left. So the plots are 3-6 months, <3 months, and >6 months. Is there a way to switch the <3 months and 3-6 months so looking at the plots you are looking at them by age increasing.
Also, if this helps, the age groups are formatted into the 3 groups, and there is only one age variable in the data set.
I know it might be difficult to determine since I am not giving screenshots but I dont have SAS on my laptop, sorry!
02-22-2017 01:38 PM
My guess is you have a character variables as your class variable. Use a numeric variable and then apply a format to have it show the description you'd like.
The default for ORDER appears to be FORMATTED, when INTERNAL is probably what you were expecting. You may just need the ORDER depending on what your data/code looked like, which we have no idea.
data class; set sashelp.class; if age < 12 then age_group=1; else if age < 15 then age_group=2; else if age >=16 then age_group=3; label age_group='Age Group'; run; proc format ; value age_fmt 1='Pre-Teen' 2='Teen' 3='Driver'; run; proc anova data=class order=internal; class age_group; model weight=age_group; format age_group age_fmt.; run;