Hi All again, Thank you for your replies. @Ksharp - I am looking for the confidence intervals of frequencies, not just the mean @Doc@Duke - I couldnt seem to see an example of a confidence interval for frequencies in your links either sorry. Based on this - http://www2.sas.com/proceedings/sugi25/25/btu/25p069.pdf (p4) I have edit some code of my own to try and acomplish my outcome of confidence intervals for frequencies. This code attempts to calculate 95% confidence intervals for QE5AM_Recode, with frequency being a sum of the WT variable. I am an amature coder so it is probably very bad code. Also, it still outputs the first table and I dont want it too. Lastly, I have to enter the n value for the confidence interval calculation (in this case the sum of WT) manually. Ideally, this value would be calculted automatically based on the dataset that was entered. Is anyone able to help make this more elagent? Kind Regards *Calculate Weighted Counts from raw dataset; PROC TABULATE DATA=WORK.QUERY_FOR_LABELS_ADDED_0001 OUT = test; VAR WT; CLASS QE5AM_Recode / MISSING; TABLE /* Row Dimension */QE5AM_Recode, /* Column Dimension */WT*(Sum); RUN; *Drop unwanted variables; DATA test_ii; set test; drop _TYPE_ _PAGE_ _TABLE_ WT_N; RUN; *Frequency to calculate Percentage; proc freq data=test_ii noprint; weight WT_sum; tables QE5AM_Recode / nocum out=test_iii; run; *Add Confidence Intervals to dataset; data test_iv; set test_iii ; P = PERCENT/100 ; *N is manually added; N = 2539; LB = P - ( 1.96*SQRT( P*(1-P)/N ) ) ; * reset lower bound to 0 if <0 ; IF LB < 0 THEN LB = 0 ; UB = P + ( 1.96*SQRT( P*(1-P)/N ) ) ; * reset upper bound to 1 if >1 ; IF UB > 1 Then UB = 1 ; label p = ’Proportion Cured’ LB = ’Lower Bound’ UB = ’Upper Bound’ ; run; *Print Results; Proc Print data=test_iv; run;
... View more