Hello. I would like to run a fisher's exact test. However, my data is weighted so I am using proc surveyfreq to obtain p-values for my contingency tables. The exact option will not work with the proc surveyfreq command. Any suggestions?
I should also add that one of my cells is 0. The nosparse option can suppress the cell but I still cannot get a p-value with the chisq option.
Thank you.
When there's an empty (zero-frequency) table cell, the Rao-Scott chi-square can't be computed because some quantities are undefined/missing. Here's one possible work-around, if you want to use zero as the standard error for the missing cell(s).
1) Construct a data set that contains one observation for each empty table cell, and assign a small weight (relative to the real survey weights) to each of these observations -- e.g., 1e-8.
2) Merge that data set with the analysis dataset. Because of the very small weights, the additional observations should not affect the estimates of proportions and totals. But all table cells will have positive frequency and SURVEYFREQ will compute the Rao-Scott chi-square test.
I don't think that there is such a thing as Fisher's Exact test for survey data, as the existence of the survey weights means you aren't dealing with integers in the analysis, which is what Exact tests require (but shhhh don't tell Sir Ronald)
Yes, that is the error message that I am getting from SAS. @PaigeMiller do you know any solution for getting a p-value with survey data when one of the cells is 0?
Thank you.
PROC SURVEYFREQ has other ways to obtain confidence intervals. There are many choices within the CL option in PROC SURVEYFREQ.
When there's an empty (zero-frequency) table cell, the Rao-Scott chi-square can't be computed because some quantities are undefined/missing. Here's one possible work-around, if you want to use zero as the standard error for the missing cell(s).
1) Construct a data set that contains one observation for each empty table cell, and assign a small weight (relative to the real survey weights) to each of these observations -- e.g., 1e-8.
2) Merge that data set with the analysis dataset. Because of the very small weights, the additional observations should not affect the estimates of proportions and totals. But all table cells will have positive frequency and SURVEYFREQ will compute the Rao-Scott chi-square test.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.