| proc logistic descending data=mydata outest=myoutput covout; |
| model d=g e g*e c1 c2 c3; |
| run; |
| data PAoutput; |
| Set myoutput; |
| array mm {*} _numeric_; |
| b0=lag4(mm[1]); |
| b1=lag4(mm[2]); |
| b2=lag4(mm[3]); |
| b3=lag4(mm[4]); |
| v11=lag2(mm[2]); |
| v12=lag(mm[2]); |
| v13=mm[2]; |
| v22=lag(mm[3]); |
| v23=mm[3]; |
| v33=mm[4]; |
| f1=(exp(b1)+(exp(b2)-2)*exp(b1+b2+b3))/((exp(b1+b2+b3)-1)*(exp(b1+b2+b3)-1)); |
| f2=(exp(b2)+(exp(b1)-2)*exp(b1+b2+b3))/((exp(b1+b2+b3)-1)*(exp(b1+b2+b3)-1)); |
| f3=((exp(b1)+exp(b2)-2)*exp(b1+b2+b3))/((exp(b1+b2+b3)-1)*(exp(b1+b2+b3)-1); |
| vINT=v11*f1*f1 + v22*f2*f2 + v33*f3*f3 + 2*v12*f1*f2 + 2*v13*f1*f3 + 2*v23*f2*f3; |
| PaINT=(exp (b2+b1+b3)-exp(b1)-exp(b2)+1)/((exp (b1+b2+b3)-1); |
| se_PaINT=sqrt(vINT); |
| ci95_lINT=PaINT-1.96*se_PaINT; |
| ci95_uINT=PaINT+1.96*se_PaINT; |
| keep PaINT ci95_lINT ci95_uINT; |
| if _n_=5; |
| run; |
| proc print data=PAoutput; |
| Var PaINT ci95_lINT ci95_uINT; |
| run; |
| The following Stata code will estimate the alternative attributable proportion measure and its confidence interval: |
| generate Ige = g*e |
| logit d g e Ige c1 c2 c3 |
| nlcom (exp (_b [g] +_b [e] +_b [Ige])-exp (_b [g])-exp (_b [e]) +1)/(exp (_b [g] +_b [e] +_b [Ige])-1) |