options nocenter ls=80 ps=50; data a; infile 'drink.dat' firstobs = 2; input cow month first $ period dim water $ milk; /* analyse first period only */ data c; set a; if period > 2 then delete; proc mixed; class month cow first period water; model milk = first period water; random cow(first); proc mixed; class month cow first period water; model milk = month first period water; random cow(month*first); /* both periods */ proc mixed data=a; class month cow first water period; model milk = month period first water period*first*water first*month; random cow(month); lsmeans first*month; /* drop unbalanced treatment combos */ data b; set a; if month = 2 then delete; proc glm; class month cow first period; model milk= month cow(month) period first first*month / ss1 ss3; test h = month e = cow(month); lsmeans month / e=cow(month) stderr pdiff; lsmeans first first*month / stderr pdiff;