## proc mixed 3-way overall interaction p-value

Solved
Occasional Contributor
Posts: 14

# proc mixed 3-way overall interaction p-value

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;

Accepted Solutions
Solution
‎03-22-2017 10:51 AM
Occasional Contributor
Posts: 14

## Re: proc mixed 3-way overall interaction p-value

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;

All Replies
PROC Star
Posts: 275

## Re: proc mixed 3-way overall interaction p-value

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

Solution
‎03-22-2017 10:51 AM
Occasional Contributor
Posts: 14

## Re: proc mixed 3-way overall interaction p-value

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;

☑ This topic is solved.