谢谢bandbird的解答,我将bandbird提供的资料贴上,请大家参考,也请大家验证,谢谢!
%macro Icc_sas(ds, response, subject); 
/*ds:資料名稱(含 library)response:反應變數名稱 subject:ID 名稱*/
 ods output OverallANOVA =all;
 proc glm data=&ds;
     class &subject;
     model &response=&subject;
 run;
 data Icc(keep=sb sw n R R_low R_up);
     retain sb sw n;
     set all end=last;
     if source='Model' then sb=ms;
     if source='Error' then do;sw=ms; n=df; end;
     if last then do;
     R=round((sb-sw)/(sb+sw), 0.01);
     vR1=((1-R)**2)/2;
     vR2=(((1+R)**2)/n +((1-R)*(1+3*R)+4*(R**2))/(n-1));
     VR=VR1*VR2;
     L=(0.5*log((1+R)/(1-R)))-(1.96*sqrt(VR))/((1+R)*(1-R));
     U=(0.5*log((1+R)/(1-R)))+(1.96*sqrt(VR))/((1+R)*(1-R));
     R_Low=(exp(2*L)-1)/(exp(2*L)+1);
     R_Up=(exp(2*U)-1)/(exp(2*U)+1);
     output;
     end;
 run;
 proc print data=icc noobs split='*';
     var r r_low r_up;
     label r='ICC*' r_low='Lower bound*' r_up='Upper bound*';
     title 'Reliability test: ICC and its confidence limits';
 run;
%mend;