BookmarkSubscribeRSS Feed
Calcite | Level 5


I want to run a repeated measure in proc mixed with double nest (site is nested in calf and calf is nested in tx) but I am not success to do it. Would you please to help revise my code below? with an example of data of two calves.


data dex1;

input calf time site $ tx $ log10cfu;


9 -1 Ear control 0

9 -1 Eye control 0

9 -1 Nose control 0

30 7 Ear Dex 0

30 7 Eye Dex 0

30 7 Nose Dex 3.574031268


proc mixed method=reml covtest data=dex1;

class calf time site tx;

model log10cfu= site time tx tx*time/ddfm=satterth solution;

random calf site site*calf site*time calf*time calf*tx calf*time*tx calf*time*tx*site;

lsmeans time*tx/ alpha=0.05 cl tdiff Pdiff;

repeated time /sub= site (calf tx) type=arh(1) r rcorr;



Many thanks for help,




Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

Consider (assuming that I understand your experimental design correctly):


proc mixed method=reml covtest data=dex1;
  class calf time site tx;
  model log10cfu= tx site tx*site time time*tx time*site time*tx*site / 
    ddfm=satterth solution;
  random calf(tx);
  *random site*calf(tx); /* this statement could be included with arh(1) or not; 
    for most other types, it is excluded because it is redundant to the 
    repeated statement */
  repeated time / subject=site*calf(tx) type=arh(1) r rcorr;
  lsmeans time*tx / alpha=0.05 cl tdiff Pdiff;


In the MIXED procedure, fixed effects that are identified in the MODEL statement are not duplicated in the RANDOM statement, so you would not have site or site*time in RANDOM.


calf*time*tx*site should be excluded from RANDOM because it identifies the residual variance; if you include it, your model is overspecified.


In my opinion, some of your terms in RANDOM are either wrong (like calf, rather than calf(tx) ) or partition variance unnecessarily (like calf*time and calf*time*tx.



Calcite | Level 5

Thank you so much sld. I appreciate your help.


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