BookmarkSubscribeRSS Feed
Calcite | Level 5

Hi, I ran into some problems with adding a continous covariate in repeated measures using proc mixed, and there is not much information on the internet. 


The situation is like measuring weight gain over time and I want to add initial weights as covariate, then compare weight gain between time points. Analysis ran well without covariate, however, when I added in the covariate, lsmeans of weight gain at different time points were not estimatable. 


here are the codes I used


data survey;
input id gain time blk wt;
1 6.00 1 2 90
1 4.80 1 1 83
2 5.80 1 2 74

2 4.40 1 1 87

1 5.25 2 2 90
1 4.00 2 1 83
2 5.00 2 2 74

2 4.70 2 1 87

1 5.25 3 2 90
1 4.50 3 1 83
2 4.25 3 2 74

2 5.10 3 1 87

proc mixed data=survey;
class id time blk;
model gain = time blk id(blk) wt;
repeated time / type = ar(1) subject = id(blk);
lsmeans time / pdiff adjust = bon;



Can anyone help? Thanks.

Jade | Level 19

First, recognize that blk is a random effect, and that you have to have a unique record for each subject.



proc mixed data=survey;
class id time blk;
model gain = time  wt;
random intercept id/subject=blk;
repeated time / type = ar(1) subject = id(blk);
lsmeans time / pdiff adjust = bon;

This gives an AR+RE model for the response variable.


HOWEVER, modeling a change variable with a covariate that is one of the elements of the change is looking for trouble.  See the following link


and especially the section:


Avoiding Change as a Response Variable in Parallel Designs

In a two-group parallel design, analysis of change is not recommended at all. The response variable should be the final measurement and the baseline measurement should be adjusted for as a covariate using analysis of covariance, with treatment assigned as one of the other variables. Besides the issues listed above, change scores are affected by regression to the mean. The slope of the baseline value may not be 1.0.


What this means is that you are adjusting for the initial body weight twice in your proposed analysis.


Steve Denham


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

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
  • 1 reply
  • 2 in conversation