BookmarkSubscribeRSS Feed
sahoositaram555
Pyrite | Level 9

Hi , i have a data set below which i have to use for generating binomial CI by WILSON method and it has to be generated by proc freq.

 

Please suggest what changes can i make in my code to get the CI with WILSON method?

proc freq data=cases;
by country ;
tables category/ nocum norow binomial(level='Y' cl=WILSON(CORRECT));

weight counts;

output out=out binomial;

run;

 

Country

infected 

total

category

counts

Algeria

10

94

Y

10

Algeria

10

94

N

84

Australia

7

1098

Y

7

Australia

7

1098

N

1091

Austria

8

3025

Y

8

Austria

8

3025

N

3017

Belgium

67

2815

Y

67

Belgium

67

2815

N

2748

 

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hi @sahoositaram555,

 

Your PROC FREQ code is correct. It does calculate (among other statistics) the Wilson confidence interval (with continuity correction) for the binomial proportion of category 'Y' for each country.

 

You can use the ODS SELECT statement to restrict the output to the CI if you like. Similarly, you can restrict the output dataset to the confidence limits and the name of the country (and the point estimate, I'd suggest) by using a KEEP= dataset option:

data cases;
input Country :$30. infected total category :$1. counts;
cards;
Algeria 10 94 Y 10
Algeria 10 94 N 84
Australia 7 1098 Y 7
Australia 7 1098 N 1091
Austria 8 3025 Y 8
Austria 8 3025 N 3017
Belgium 67 2815 Y 67
Belgium 67 2815 N 2748
;

ods select binomialCLs;
proc freq data=cases;
by country;
tables category / binomial(level='Y' cl=WILSON(CORRECT));
weight counts;
output out=out(keep=country _: l: u:) binomial;
run;

 

 

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1631 views
  • 2 likes
  • 2 in conversation