BookmarkSubscribeRSS Feed
edomachowske
Calcite | Level 5

Hello,

 

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, ❤️ months, and >6 months. Is there a way to switch the ❤️ 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!

Thank you!

1 REPLY 1
Reeza
Super User

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;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1 reply
  • 938 views
  • 0 likes
  • 2 in conversation