Hi Everyone,
I have attempted to conduct chi-square tests using my research group's survey dataset on SAS 9.4; however, SAS was unable to compute the required chi-square statistics/p-values using my dataset due to the following reason:
NOTE: Chi-square tests cannot be computed for the table of SEX by LANG because at least one table
cell has 0 frequency.
Frankly, this error message is highly problematic because most of the dataset contain cells with 0 frequency after conducting a cross-tabulation of variables on SAS. Therefore, I would like to inquire whether any expert in the community may know of a different type of statistical tests that are analogous to the wald chi-square test in terms of determining the relationship between the independent variable and dependent variable by computing p-values. Thank you very much in advance!
Best,
Lisa
It's not the error message that's problematic, it is your data that is problematic.
Can you share with us the number of data points in each cell, and the code you are using?
Hi Paige,
Thank you for your response. Please find below the sample code for one of the cross-tabulations.
Yes, the weighted frequency in each cell is what I want.
Hi Paige,
Please find below a sample dataset that includes the percentages and weighted frequencies. Thanks!
Immigration Status (%, n) | Total=1428 | Male=1391 | Female=37.10 | |
Born in the U.S. | 30.66 (437.84) | 29.54 (421.91) | 1.12 (15.93) | |
Naturalized Citizen | 4.78 (68.24) | 4.42 (63.08) | 0.36 (5.16) | |
Legal Resident | 16.10 (230.01) | 15.82 (225.94) | 0.28 (4.08) | |
Visa Worker | 5.06 (72.40) | 4.93 (70.46) | 0.14 (1.94) | |
Undocumented | 31.83 (454.62) | 31.42 (448.69) | 0.41 (5.92) | |
Refuse | 11.55 (164.98) | 11.26 (160.91) | 0.28 (4.08) |
Hi Paige,
Please ignore the previous dataset because I just realized that I was able to compute a wchisq p-value using that set of data.
Please find the new dataset below that is problematic.
Table of WATER by HEAT_1 WATER HEAT_1 Frequency Weighted
Frequency Std Err of
Wgt Freq Percent Std Err of
Percent EMPLOYER 0 1 2 3 4 Total GC 0 1 2 3 4 Total NONE 0 1 2 3 4 Total REFUSE 0 1 2 3 4 Total SELF 0 1 2 3 4 Total SUB 0 1 2 3 4 Total Total 0 1 2 3 4 Total Frequency Missing = 1
3 | 4.48080 | 3.57479 | 0.3141 | 0.2502 |
186 | 170.80100 | 17.33165 | 11.9719 | 1.1794 |
201 | 215.70530 | 20.02574 | 15.1193 | 1.3390 |
226 | 203.39680 | 18.87854 | 14.2566 | 1.2752 |
138 | 188.13820 | 19.72814 | 13.1871 | 1.3156 |
754 | 782.52210 | 33.74747 | 54.8489 | 1.8157 |
1 | 1.67200 | 1.67200 | 0.1172 | 0.1172 |
41 | 26.80870 | 7.21888 | 1.8791 | 0.5035 |
38 | 35.50600 | 10.77292 | 2.4887 | 0.7445 |
33 | 18.61870 | 4.62034 | 1.3050 | 0.3249 |
27 | 31.25230 | 7.64386 | 2.1906 | 0.5330 |
140 | 113.85770 | 15.62050 | 7.9806 | 1.0632 |
0 | . | . | . | . |
4 | 4.77570 | 2.57006 | 0.3347 | 0.1802 |
2 | 5.16230 | 3.86906 | 0.3618 | 0.2707 |
2 | 1.56880 | 1.29023 | 0.1100 | 0.0905 |
1 | 3.49030 | 3.49030 | 0.2446 | 0.2443 |
9 | 14.99710 | 5.94218 | 1.0512 | 0.4148 |
0 | . | . | . | . |
0 | . | . | . | . |
2 | 0.88580 | 0.63785 | 0.0621 | 0.0448 |
0 | . | . | . | . |
1 | 1.67200 | 1.67200 | 0.1172 | 0.1172 |
3 | 2.55780 | 1.78896 | 0.1793 | 0.1254 |
3 | 5.53350 | 3.88648 | 0.3879 | 0.2719 |
105 | 102.17350 | 13.10830 | 7.1616 | 0.9071 |
117 | 116.41740 | 14.10271 | 8.1600 | 0.9726 |
165 | 140.71050 | 14.41749 | 9.8627 | 1.0025 |
122 | 129.44480 | 14.39659 | 9.0731 | 0.9956 |
512 | 494.27970 | 25.93700 | 34.6453 | 1.6986 |
0 | . | . | . | . |
2 | 1.41380 | 1.26109 | 0.0991 | 0.0884 |
6 | 6.83570 | 3.04878 | 0.4791 | 0.2138 |
6 | 5.52040 | 2.62661 | 0.3869 | 0.1842 |
2 | 4.70230 | 4.03727 | 0.3296 | 0.2824 |
16 | 18.47220 | 5.82380 | 1.2948 | 0.4071 |
7 | 11.68630 | 5.53366 | 0.8191 | 0.3864 |
338 | 305.97270 | 22.25651 | 21.4464 | 1.4803 |
366 | 380.51250 | 26.12400 | 26.6711 | 1.6589 |
432 | 369.81520 | 23.27418 | 25.9213 | 1.5525 |
291 | 358.69990 | 25.16904 | 25.1422 | 1.6174 |
1434 | 1427 | 36.26149 | 100.000 |
Hi Paige,
Please again ignore the dataset that I just submitted as the formatting is entirely distorted.
Please use the dataset below. Thanks!
Language Fluency (%, n) | Total=1428 | Male=1391 | Female=37.10 | |
English | 18.64 (266.26) | 18.14 (259.10) | 0.50 (7.16) | |
Spanish | 50.54 (721.88) | 49.67 (709.36) | 0.88 (12.52) | |
Both | 28.80 (411.43) | 27.75 (396.30) | 1.06 (15.14) | |
Other | 0.46 (6.64) | 0.46 (6.64) | 6.15 (2.28) |
I find this impossible to understand.
Hi Paige,
Just to clarify, the weighted frequencies are all within the parentheses following the percentages. Hope this helps a bit! Thanks!
This table gives the exact same error message quoted above, that there is a cell with zero frequency?
Hi Paige,
I think the attached document with the original cross-tabulation table with sex by language should provide a more clear overview of the problem. The previous dataset that I have posted was the modified table after combining the weighted frequencies of several groups.
I don't download Microsoft Office documents, as they can be security threats. Please place your information in a text file.
Hi Paige,
I have converted the word document into a text document. Thanks!
Best,
Lisa
Ok, this isn't working.
I asked a simple yes or no question. I don't see where you have answered the question. I asked:
This table gives the exact same error message quoted above, that there is a cell with zero frequency?
Hi Paige,
I apologize for missing your questions earlier. Nevertheless, the table with Sex by Lang does show the error message that at least one table cell has 0 frequency. Thanks!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.