## Test for SigDiff by Date in Proc MIXED repeated measures in SAS University

Solved
Occasional Contributor
Posts: 17

# Test for SigDiff by Date in Proc MIXED repeated measures in SAS University

I have a code written for a split-plot analysis with repeated measures written with Proc MIXED. However, I have not been able to write a code that will deliver results for whether dates are significantly different from each other. LS Means commands do this quite nicely, but i haven't been able to write an LS Means code that produces an output. 4 plots in 4 Blocks (N=4), and the plot is what the repeated measures are performed on (n=16). PlotID was written to give each plot a unique ID. Compound Symmetry was determined to be the best covariance structure for the data. How do i write code to test if the mean logN2O values differ by Date?

Code:

ODS graphics on ;
proc mixed data=AllEvents covtest;
Class Block Fert Nfix Date PlotID;
Model logN2O= Fert Nfix Fert*Nfix / s;
Random Block Block*Fert;
Repeated / Type=CS subject=plotID r;
run;

Accepted Solutions
Solution
‎07-19-2017 06:03 PM
PROC Star
Posts: 229

## Re: Test for SigDiff by Date in Proc MIXED repeated measures in SAS University

The design structure of your study is not totally clear to me. If levels of both FERT and NFIX are assigned randomly to plots within blocks, then something like this might be appropriate:

``````proc mixed data=AllEvents covtest;
class block fert nfix date plotid;
model logN2O= fert|nfix|date / s;
random block;  *random block*fert*nfix; /* deliberately omitted for type=cs */
repeated date / subject=block*fert*nfix type=cs;
run;``````

Note that block*fert*nfix identifies the same levels of a random effects factor as does plotid.

See http://onlinelibrary.wiley.com/doi/10.1002/1097-0258(20000715)19:13%3C1793::AID-SIM482%3E3.0.CO;2-Q/... for a discussion of when

``random block*fert*nfix;``

would be included depending on covariance structure type.

See the SAS documentation for the REPEATED statement in MIXED for details about using "repeated date / subject=..." rather than "repeated / subject=...".

All Replies
PROC Star
Posts: 229

## Re: Test for SigDiff by Date in Proc MIXED repeated measures in SAS University

If you want to compare mean logN2O among dates, the DATE factor must be in the MODEL statement.

Occasional Contributor
Posts: 17

## Re: Test for SigDiff by Date in Proc MIXED repeated measures in SAS University

I assume that is true as well. The question then becomes how to correctly write the error term(s) for including Date? Or does Proc MIXED do that automatically?

Solution
‎07-19-2017 06:03 PM
PROC Star
Posts: 229

## Re: Test for SigDiff by Date in Proc MIXED repeated measures in SAS University

The design structure of your study is not totally clear to me. If levels of both FERT and NFIX are assigned randomly to plots within blocks, then something like this might be appropriate:

``````proc mixed data=AllEvents covtest;
class block fert nfix date plotid;
model logN2O= fert|nfix|date / s;
random block;  *random block*fert*nfix; /* deliberately omitted for type=cs */
repeated date / subject=block*fert*nfix type=cs;
run;``````

Note that block*fert*nfix identifies the same levels of a random effects factor as does plotid.

See http://onlinelibrary.wiley.com/doi/10.1002/1097-0258(20000715)19:13%3C1793::AID-SIM482%3E3.0.CO;2-Q/... for a discussion of when

``random block*fert*nfix;``

would be included depending on covariance structure type.

See the SAS documentation for the REPEATED statement in MIXED for details about using "repeated date / subject=..." rather than "repeated / subject=...".

☑ This topic is solved.