BookmarkSubscribeRSS Feed
Chuckytron
Calcite | Level 5

I am learning proc mixed. I have the following model:

proc mixed;

  class group;

  model post = group pre group*pre/ddfm=kr;

The interaction term is significant. How do I take a difference in the lines and construct a 95% confidence band around the difference?

1 REPLY 1
SteveDenham
Jade | Level 19

Warning.  Untested code will follow.

I think you will need lsmeans statements that set the value of pre.  Something like:

proc mixed;

  class group;

  model post = group pre group*pre/ddfm=kr;

  lsmeans group/diff at pre=val1 cl adjdfe=row;

  lsmeans group/diff at pre=val2 cl adjdfe=row;

  lsmeans group/diff at pre=val3 cl adjdfe=row;

  lsmeans group/diff at pre=val4 cl adjdfe=row;

  lsmeans group/diff at pre=val5 cl adjdfe=row;

  ods output diffs=diffs;

run;

The dataset diffs should include the differences between all least squares means of group at various values (val1 through val5) of pre. Here I have variable names, but you really need the values at which you want to estimate the least squares means.  I include an ODS output statement, in case you want to plot the differences and their confidence limits.

Good luck.

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!

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
  • 1069 views
  • 0 likes
  • 2 in conversation