DATA Step, Macro, Functions and more

Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

Reply
Contributor
Posts: 25

Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

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

Respected Advisor
Posts: 3,016

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

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? 

--
Paige Miller
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

Posted in reply to PaigeMiller

Hi Paige,

 

Thank you for your response. Please find below the sample code for one of the cross-tabulations.

 

proc surveyfreq data=wdp.newzhang;
 
tables sex*lang / wchisq;
 
weight weight_3;
 
run;
 
As for the number of data points in each cell, I am not exactly sure what you specifically mean, such as the weighted frequencies for each cell level? Thanks so much!

 

Respected Advisor
Posts: 3,016

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

Yes, the weighted frequency in each cell is what I want. 

--
Paige Miller
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

Posted in reply to PaigeMiller

Hi Paige,

 

Please find below a sample dataset that includes the percentages and weighted frequencies. Thanks!

Immigration Status (%, n)  Total=1428Male=1391Female=37.10
 Born in the U.S.30.66 (437.84)29.54 (421.91)1.12 (15.93)
 Naturalized Citizen4.78 (68.24)4.42 (63.08)0.36 (5.16)
 Legal Resident16.10 (230.01)15.82 (225.94)0.28 (4.08)
 Visa Worker5.06 (72.40)4.93 (70.46)0.14 (1.94)
 Undocumented31.83 (454.62)31.42 (448.69)0.41 (5.92)
 Refuse11.55 (164.98)11.26 (160.91)0.28 (4.08)
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

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

34.480803.574790.31410.2502
186170.8010017.3316511.97191.1794
201215.7053020.0257415.11931.3390
226203.3968018.8785414.25661.2752
138188.1382019.7281413.18711.3156
754782.5221033.7474754.84891.8157
11.672001.672000.11720.1172
4126.808707.218881.87910.5035
3835.5060010.772922.48870.7445
3318.618704.620341.30500.3249
2731.252307.643862.19060.5330
140113.8577015.620507.98061.0632
0....
44.775702.570060.33470.1802
25.162303.869060.36180.2707
21.568801.290230.11000.0905
13.490303.490300.24460.2443
914.997105.942181.05120.4148
0....
0....
20.885800.637850.06210.0448
0....
11.672001.672000.11720.1172
32.557801.788960.17930.1254
35.533503.886480.38790.2719
105102.1735013.108307.16160.9071
117116.4174014.102718.16000.9726
165140.7105014.417499.86271.0025
122129.4448014.396599.07310.9956
512494.2797025.9370034.64531.6986
0....
21.413801.261090.09910.0884
66.835703.048780.47910.2138
65.520402.626610.38690.1842
24.702304.037270.32960.2824
1618.472205.823801.29480.4071
711.686305.533660.81910.3864
338305.9727022.2565121.44641.4803
366380.5125026.1240026.67111.6589
432369.8152023.2741825.92131.5525
291358.6999025.1690425.14221.6174
1434142736.26149100.000 
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

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=1428Male=1391Female=37.10
 English18.64 (266.26)18.14 (259.10)0.50 (7.16)
 Spanish50.54 (721.88)49.67 (709.36)0.88 (12.52)
 Both28.80 (411.43)27.75 (396.30)1.06 (15.14)
 Other0.46 (6.64)0.46 (6.64)6.15 (2.28)
Respected Advisor
Posts: 3,016

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

I find this impossible to understand. 

--
Paige Miller
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

Posted in reply to PaigeMiller

Hi Paige,

 

Just to clarify, the weighted frequencies are all within the parentheses following the percentages. Hope this helps a bit! Thanks!

 

 

Respected Advisor
Posts: 3,016

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

This table gives the exact same error message quoted above, that there is a cell with zero frequency?

--
Paige Miller
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

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.

 

 

Respected Advisor
Posts: 3,016

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

I don't download Microsoft Office documents, as they can be security threats. Please place your information in a text file.

--
Paige Miller
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

Posted in reply to PaigeMiller

Hi Paige,

 

I have converted the word document into a text document. Thanks!

 

Best,

Lisa

Respected Advisor
Posts: 3,016

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

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?

--
Paige Miller
Contributor
Posts: 25

Re: Dilemma: Conducting Statistical Tests Using Proc Surveyfreq Statement on SAS 9.4

Posted in reply to PaigeMiller

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!

Ask a Question
Discussion stats
  • 24 replies
  • 222 views
  • 0 likes
  • 3 in conversation