I want to calculate 95% CI for proportion/percentage for a dataset as the following. Original dataset a, I would like to have an output dataset b as such. I have tried some program but not sure if it was correct. Do you have different ways to calculate the 95% CI? Thanks for helping in advance. Dataset a Disease cases Denominator proportion A 2 120 0.167 B 5 300 0.167 C 3 1000 0.3 D 11 500 0.2 Dataset B Disease cases Denominator proportion CI_low CI_high A 2 120 0.167 B 5 300 0.167 C 3 1000 0.3 D 11 500 0.2 SAS program I tried: data b; set a; p=(cases/denominator); if p=0 then CI_Low=0; if p=1 then CI_High=1; if p ne 0 then CI_Low=(1-betainv(.975, (Denominator-cases+1), cases)); if p ne 1 then CI_High=(1-betainv(.025, (Denominator-cases), cases+1); run;
... View more