BookmarkSubscribeRSS Feed
lauragrau
Calcite | Level 5

Good morning,

 

I have a longitudinal dataset with three variables: group, week, and outcome (y). 

Group is binary 0/1.

Week is continuous 1-6.

Outcome is continuous.

 

I'm running a mixed model, testing whether there was a significant interaction between week and group.

 

proc mixed data=data;
class id group(ref=first) ;
model y=week group group*week;
random intercept week /sub=id type=un ;
run;

 

How would I write an estimate statement to test whether there was a significant difference in average y between weeks 1-3 and 4-6 between the two groups? 

2 REPLIES 2
sbxkoenk
SAS Super FREQ

Look at this wealth of info on ESTIMATE and CONTRAST statements in SAS/STAT:

 

The magical ESTIMATE (and CONTRAST) statements

By Chris Daman on SAS Learning Post April 23, 2012

https://blogs.sas.com/content/sastraining/2012/04/23/the-magical-estimate-and-contrast-statements/

 

"Easy button" for ESTIMATE statements

By Chris Daman on SAS Learning Post April 25, 2012

https://blogs.sas.com/content/sastraining/2012/04/25/easy-button-for-estimate-statements/

 

ESTIMATE Statements - the final installment

By Chris Daman on SAS Learning Post May 2, 2012

https://blogs.sas.com/content/sastraining/2012/05/02/estimate-statements-the-final-installment/

 

How to write CONTRAST and ESTIMATE statements in SAS regression procedures?

By Rick Wicklin on The DO Loop June 6, 2016

https://blogs.sas.com/content/iml/2016/06/06/write-contrast-estimate-statements-sas-regression-proce...

 

Usage Note 24447: Examples of writing CONTRAST and ESTIMATE statements

https://support.sas.com/kb/24/447.html

 

Usage Note 67024: Using the ESTIMATE or CONTRAST statement or Margins macro to assess continuous variable effects in interactions and splines

67024 - Using the ESTIMATE or CONTRAST statement or Margins macro to assess continuous variable effe...

 

Good luck,

Koen

 

jiltao
SAS Super FREQ

 

You treated WEEK as a continuous variable. Then when you say weeks 1-3, do you mean the average for week 1 to week 3? That is, the average value for WEEK is 2? Similarly, weeks 4-6 means the average value for WEEK would be 5? If so, you might see if the following ESTIMATE statement does what you want:

proc mixed data=data;
class id group(ref=first) ;
model y=week group group*week;
random intercept week /sub=id type=un ;
estimate "difference between weeks 1-3 and 4-6 for group 2 versus difference between weeks 1-3 and 4-6 for group 1' group*week -3 3;
run;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 973 views
  • 1 like
  • 3 in conversation