I am running the following model to run a repeated measures ancova. the data has 2 treatment groups, 2 stratification levels and 5 time points (baseline, 1m, 6m, 12m, 24m). The dependent variable is the score at post-baseline time points (1,6,12,24 months).
My question is, how do I get an overall p-value for the 3-way interaction at each post-baseline timepoint? I am not sure of how to write a contrast statement to accomplish this? Please help!
proc mixed data=growth noclprint order=formatted covtest noitprint method=reml;
class group pt strata time(ref="1");
model score = baseline_score group time time*group strata group*strata time*strata time*group*strata/solution ddfm=bw notest;
random pt /vcorr;
lsmeans time*group*strata/pdiff cl ;
ods output SolutionF=est_(keep=effect estimate stderr probt)
LSMeans=lsm_(keep=effect group strata time estimate lower upper)
Diffs=diff_(keep=effect group strata _group _strata time _time estimate lower upper probt);
run;
Here is a contrast statement that works: (you can write the statement for other time points in a similar fashion)
proc mixed data=growth noclprint order=formatted covtest noitprint method=reml;
class group pt strata time(ref="1");
model score = baseline_score group time time*group strata group*strata time*strata time*group*strata/solution ddfm=bw notest;
random pt /vcorr;
contrast 'pvalue at 1 month'
group*strata 1 -1 -1 1 time*group*strata 1 0 0 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 1 0 0 0 0 0;
lsmeans time*group*strata/pdiff cl ;
ods output Contrasts=cont_(keep=label probf)
SolutionF=est_(keep=effect estimate stderr probt)
LSMeans=lsm_(keep=effect group strata time estimate lower upper)
Diffs=diff_(keep=effect group strata _group _strata time _time estimate lower upper probt);
run;
Do you mean the interaction of group and strata at each value of time? In other words, a two-way interaction rather than three-way?
If so, then you can do this using the LSMESTIMATE statement, with the AT option to specify an appropriate value for baseline_score at which to estimate the lsmeans. It's worth taking the time to figure out how to use the nonpositional syntax for LSMESTIMATE. See
https://support.sas.com/resources/papers/proceedings11/351-2011.pdf
Here is a contrast statement that works: (you can write the statement for other time points in a similar fashion)
proc mixed data=growth noclprint order=formatted covtest noitprint method=reml;
class group pt strata time(ref="1");
model score = baseline_score group time time*group strata group*strata time*strata time*group*strata/solution ddfm=bw notest;
random pt /vcorr;
contrast 'pvalue at 1 month'
group*strata 1 -1 -1 1 time*group*strata 1 0 0 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 1 0 0 0 0 0;
lsmeans time*group*strata/pdiff cl ;
ods output Contrasts=cont_(keep=label probf)
SolutionF=est_(keep=effect estimate stderr probt)
LSMeans=lsm_(keep=effect group strata time estimate lower upper)
Diffs=diff_(keep=effect group strata _group _strata time _time estimate lower upper probt);
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.