BookmarkSubscribeRSS Feed
jgreenberg321
Fluorite | Level 6

Hello,

 

I am interested in plotting the predicted probabilities from an interaction I've created using proc genmod. I would like to have the x-axis be a categorical variable by year, so the probabilities are displayed as strait lines between years. I set year as a categorical variable in my model with 2011 (earliest year) as the reference. However, when I create the effect plot, the years are displaying out of order. Does anyone know if there is an easy way to set the ordering/levels of the categorical variable on the x-axis. For reference, example code is below. Thank you!

 

proc plm source=genmod;

effectplot interaction (x=year sliceby=group ) ;

run;

1 REPLY 1
StatDave
SAS Super FREQ

Try explicitly setting the order for the YEAR variable in your CLASS statement so that its levels are ordered by its internal levels. For example:

proc genmod;
class group year(order=internal);
model y=group year;
effectplot interaction(x=year sliceby=group);
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 838 views
  • 1 like
  • 2 in conversation