DATA Step, Macro, Functions and more

Confidence intervals for ratio/proportion

Occasional Contributor
Posts: 7

Confidence intervals for ratio/proportion

Hi all,

I have a data set containing the following variables of interest:


study id

male_n (number of males with study disease)

male_TotN (total number of males in study)

male_percent (calculated percentage of males with study disease)


female_n (number of females with study disease)

female_TotN (total number of females in study)

female_percent (calculated percentage of females with study disease)

MFR (male-female-ratio (male_percent/female_percent))


What I need to produce is a confidence interval for this MFR and eventually a forest plot, showing these ratios. Since I don’t have the CIs, I haven’t looked at making a forest plot yet, possibly I would be able to figure this out myself. My skill level is very low, unfortunately, so I’m generally not able to make use of the many articles written by SAS professionals for other SAS professionals, though I did try this first.


Thanks for looking



Posts: 4,242

Re: Confidence intervals for ratio/proportion

First, use proportions rather than percentages. What you have an an estimate for the ratio of two proportions. What you want is called the confidence interval for the ratio.


One way to do this is to log-transform the ratio, use a standard equation to find the confidence interval, and then exponentiate to transform back. Look up the section of the PROC FREQ doc about odds ratios and relative risks for 2x2 tables. The section "Confidence Limits for the Odds Ratio" explains the math.


If this is what you are looking for, then I suggest you post sample data for 3 or 4 studies. (The data can be fake.) Someone ought to be able to show you how to get the data from the format you have into a format that PROC FREQ requires for analysis.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation