# proc freq: how to calculate fisher exact test with non-integers

#### publichealthstudent

##### New Member
Background: For my bivariate analysis, I am trying to perform the Fisher's exact test where the expected cell frequency is less than 5 (using proc FREQ). In one of my datasets I have to use a weight statement (in order to analyze a representative value of cases reported per county based on the percentage of randomly selected cases interviewed in that county). As a result, a lot of my (weighted) cell frequencies are non-integers.

Problem: Because some cell values are non-integers SAS is telling me: " WARNING: exact p-values cannot be computed when there are non-integer frequencies".

Question: Does anyone know a way around this? In other words, how can I calculate fisher exact tests when I have non-integer values (yes, I have to use weighted values)? Is there maybe a way to ask SAS to round the weighted frequencies to the nearest integer for the exact test?

The code I'm using that pertains to this question:

proc freq data= std.cases;
weight wtcap;
TABLE ATTND*(/*demographics*/ GENDER2 AGEGR2 ) / CHISQ nopercent NOCOL NOROW;
exact fisher;
run;

Thanks for any help with this!
Lucy

Last edited:

Hello Lucy,

Sincerely,
SPR

#### publichealthstudent

##### New Member
Hi SPR,

Thanks for your response. Below is an example of the data I have along with an example of the output I'm getting for the proc tabulate procedure I'm using.

Thanks for any help you can offer regarding weighted datasets! I've asked around and not many people have experience using weighted data.

data example (all categorical variables):
gender, age, race/ethnicity, clinic type
Male, 14-19 , white, Non-STD Clinic
Male , 20-29, african amer, Non-STD Clinic
Female, 20-29, Asian ,STD Clinic Attendance
Male, 40+, African Amer, STD Clinic Attendance
Female , 20-29, Hispanic, STD Clinic Attendance

Example output using proc tabulate code in previous post:
characteristic, STD clinic cases (weighted), %, Non-STD clinic cases (weighted), %

Total cases, 5371 , 100, 780 , 100

gender
Male , 2900, 51.8, 676 , 91.1
Female, 2471 , 48.2, 104 , 8.8

Age group (4 categories)
14-19 , 1335 , 23.6, 66.9 , 5.2
etc...

Is this what you were looking for? Thank you for your help!!

Lucy

Last edited:

#### SPR

##### New Member
Hello Lucy,

I've tried to reproduce your results on my computer but still do not have enough infomation.

proc freq data= std.cases;
weight wtcap;
TABLE ATTND*(/*demographics*/ GENDER2 AGEGR2 ) / CHISQ nopercent NOCOL NOROW;
exact fisher;
run;

I do not see the following varibales in your example: wtcap and ATTND.

Sincerely,
SPR