filename ped448 'p448.dat';
options center linesize=78 nodate;
data;
infile ped448;
input @4 row col y; 
/* Generate dummy coded vectors */
if row=1 and col=1 then d11=1; else d11=0;
if row=1 and col=2 then d12=1; else d12=0;
if row=1 and col=3 then d13=1; else d13=0;
if row=2 and col=1 then d21=1; else d21=0;
if row=2 and col=2 then d22=1; else d22=0;
if row=2 and col=3 then d23=1; else d23=0;
if row=3 and col=1 then d31=1; else d31=0;
if row=3 and col=2 then d32=1; else d32=0;
if row=3 and col=3 then d33=1; else d33=0;
/* Generate orthogonal contrast vectors */
c1=(d11+d12+d13)-(d21+d22+d23);
c2=(d11+d12+d13+d21+d22+d23)-2*(d31+d32+d33);
c3=(d11+d21+d31)-(d12+d22+d32);
c4=(d11+d12+d21+d22+d31+d32)-2*(d13+d23+d33);
c5=(d11+d22)-(d12+d21);
c6=(d11+d12)-(d21+d22)-2*d13+2*d23;
c7=(d11+d21)-(d12+d22)-2*d31+2*d32;
c8=(d11+d12+d21+d22)-2*(d13+d23+d31+d32)+4*d33;
proc print;
proc reg;
  model y=d11 d12 d13 d21 d22 d23 d31 d32/corrb;
  model y=c1 c2 c3 c4 c5 c6 c7 c8/corrb;
proc anova;
  class row col;
  model y=row col row*col;
run;
quit;