options nocenter ps=64 ls=79;

   *---------------Repeated Measures Example-----------*
   | Data represent a repeated measures example where  |
   | an unstructured variance matrix is fit.  Data are |
   | from Pothoff and Roy (1964) and are analyzed by   |
   | Jennrich and Schluchter (1986).                   |
   *---------------------------------------------------*;

data prglm;
   infile 'pothoff.dat' firstobs=2;
   input person sex $ y1 y2 y3 y4;
data pr; set prglm;
   y=y1; age=8;  output;
   y=y2; age=10; output;
   y=y3; age=12; output;
   y=y4; age=14; output;
   drop y1-y4;

/* prog glm run */
proc glm data=prglm;
   class sex;
   model y1-y4=sex / nouni ss1;
   repeated age 4 (8 10 12 14) polynomial / summary printe;

 /* compound symmetry */
proc mixed data=pr;
   class person sex age;
   model y = sex|age;
   repeated / type=cs sub=person;

 /* unstructured variance matrix */
proc mixed data=pr;
  class person sex age;
  model y = sex|age;
  repeated / type=un sub=person;

/* compound symmetry specified on RANDOM statement*/
proc mixed data=pr;
   class person sex age;
   model y = sex|age;
   random person;

/* polynomial contrasts with unstructured variance matrix */
proc mixed data=pr;
  class person sex;
  model y = sex|age|age|age / htype=1;
  repeated / type=un sub=person;
