pigchenjh 发表于 2014-12-25 09:38 
举个例子看看呢
data A;
input nit xit nic xic;
yi=log((xit/(nit-xit))/(xic/(nic-xic)));
si_square=1/xit+1/(nit-xit)+1/xic+1/(nic-xic);
cards;
87 64 85 48
146 90 155 99
50 44 50 33
242 150 240 143
59 43 59 38
163 133 169 128
96 42 87 35
192 105 189 113
491 432 488 423
165 121 179 134
run;
proc print data=A;
var yi si_square;
run;
data B;
set A;
xi=1/(nit+nic);
beit0=0;
do while(jj<=0.01)
wi1=1/(si_square+beit0*xi);
wi2_x=(1/(si_square+beit0*xi))*(1/(si_square+beit0*xi))*xi;
wi2_x2=(1/(si_square+beit0*xi))*(1/(si_square+beit0*xi))*xi*xi;
n1=yi/si_square;
s1+1/si_square;
s1_+wi1;
s2+wi2_x2;
m1+n1;
u=m1/s1;
wiy_u=wi2_x*((yi-u)*(yi-u)+1/s1_-si_square);
ss+wiy_u;
do i=1 to 14;
beit=ss/s2;
kk=u-u0;
jj=beit-beit0;
beit0=beit;(这一点我想取beit的最后一个观测赋给beit0,然后用新的beit0再第二次迭代)
end;
run;
proc print data=B;
run;