11.3 - SAS Programming for Steer Example

The full SAS code includes the coded data which you can also found in the data file Steer Data. This SAS code will run the repeated measures ANCOVA in SAS.

data steer;
input PER      SEQ      DIET  $    STEER      NDF x1 x2;
datalines;
1      1      A      1      50      0      0
1      1      A      2      55      0      0
1      2      B      1      44      0      0
1      2      B      2      51      0      0
1      3      C      1      35      0      0
1      3      C      2      41      0      0
1      4      A      1      54      0      0
1      4      A      2      58      0      0
1      5      B      1      50      0      0
1      5      B      2      55      0      0
1      6      C      1      41      0      0
1      6      C      2      46      0      0
2      1      B      1      61      1      0
2      1      B      2      63      1      0
2      2      C      1      42      0      1
2      2      C      2      45      0      1
2      3      A      1      55      -1      -1
2      3      A      2      56      -1      -1
2      4      C      1      48      1      0
2      4      C      2      51      1      0
2      5      A      1      57      0      1
2      5      A      2      59      0      1
2      6      B      1      56      -1      -1
2      6      B      2      58      -1      -1
3      1      C      1      53      0      1
3      1      C      2      57      0      1
3      2      A      1      57      -1      -1
3      2      A      2      59      -1      -1
3      3      B      1      47      1      0
3      3      B      2      50      1      0
3      4      B      1      51      -1      -1
3      4      B      2      54      -1      -1
3      5      C      1      51      1      0
3      5      C      2      55      1      0
3      6      A      1      58      0      1
3      6      A      2      61      0      1
;
run;

/* Model Adjusting for carryover effects */
proc mixed data= steer;
class per seq diet steer;
model ndf = per diet seq x1 x2;
repeated per / subject=steer(seq) type=csh;
store out_steer;
run;

ods graphics on;
ods html style=statistical sge=on;

proc plm restore=out_steer;
lsmeans diet / adjust=tukey plot=meanplot cl lines;
ods exclude diffs diffplot;
run;

/* Reduced Model, Ignoring carryover effects */
proc mixed data= steer;
class per seq diet steer;
model ndf = per diet seq;
repeated per / subject=steer(seq) type=csh;
lsmeans diet / pdiff adjust=tukey;
run;

I am using the heterogeneous compound symmetry(type=CSH) covariance structure because it provided a better fit compared to UN or CS or AR(1). The CSH covariance structure, like the CS, has a constant correlation in the off-diagonal elements. However, the diagonal elements (the variance at each time point), can differ.

Here is the output that is generated:

Type 3 Tests of Fixed Effects
Effect Num DF Den DF F Value Pr > F
PER 2 50.9 10.86 0.0146
DIET 2 11.6 188.52 < .001>
SEQ 5 10.9 31.96 < .0001
x1 1 11.2 17.03 0.0016
x2 1 11.2 78.85 < .0001

The Type 3 tests are 'model based' meaning that results for each of the effects are adjusted for the other effects in the model. In this case, we have adjusted for the presence of carry-over effects. We see that the diet is significant, and so we generate LSMEANS for the diet and the Tukey-Kramer mean comparisons:

DIET Least Squares Means
DIET Estimate Standard Error DF t Value Pr > |t| Alpha Lower upper
A 57.8092 1.6046 6.412 36.03 < 0.001 0.05 53.9432 61.6752
B 50.8134 1.6046 6.412 31.67 < 0.001 0.05 46.9474 54.6794
C 48.3774 1.6046 6.412 30.15 < 0.001 0.05 44.5114 52.2434

To see the adjustment on the treatment means, we can compare the LSmeans for a reduced model that does not contain the carry-over covariates.

LSMeans

Full Model with Covariates
Effect DIET Estimate
DIET A 57.8092
DIET B 50.8134
DIET C 48.3774
Reduced Model (without carry-over covariates)
Effect DIET Estimate
DIET A 57.3941
DIET B 50.9766
DIET C 48.6292

Although the differences in the LSmeans between the two models are small in this particular example, these carry-over effect adjustments can be very important in some research situations.