turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Dilemma: Conducting Wald Chi-Square Test Using Pro...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-20-2017 03:31 PM

```
proc surveyfreq data=wdp.newzhang;
tables sex*lang / wchisq;
weight weight_3;
run;
```

Hi Everyone,

I have encountered a major issue when attempting to conduct a wald chi-square test of independence using survey data. Specifically, SAS would not provide the results of the wald chi-square test in the output table, which I do not understand. Therefore, I would greatly appreciate it if a knowledgeable SAS user with a certain level of experience with conducting statistical analyses using survey data could provide a feasible solution on this dilemma. Thanks in advance!

Please find below a copy of the SAS code that I have attempted to run.

tables sex*lang / wchisq;

weight weight_3;

Best,

Lisa

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yli33

10-20-2017 03:45 PM

Please explain this part in more detail:

SAS would not provide the results of the wald chi-square test in the output table

Does that mean it wasn't calculated? or displayed? Or do you want it in an output data set to use somewhere else and don't know how to do that? It would also help if you could replicate your issue using either a SASHELP data set (CLASS, CAR or HEART are good ones) so we can run the code and replicate the issue. This way we can determine if it's a data or code issue.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

10-20-2017 04:07 PM

Hi,

Thank you for responding. I apologize for the confusion on the unavailable

SAS output for the Wald Chi-Square Test that I have mentioned earlier.

Specifically, the results of the Wald chi-square would not display when

running the command. I am only able to view the 2-way weighted frequency

table as the only displayed output.

I am actually a beginner in SAS and am not really familiar with the SASHELP

datasets that you have specified. Nevertheless, hopefully you would be able

to provide a solution based on my clarification above. If not, I would

greatly appreciate it if you describe in more detail on the steps involved

to replicate a SASHELP dataset. Thanks!

Thank you for responding. I apologize for the confusion on the unavailable

SAS output for the Wald Chi-Square Test that I have mentioned earlier.

Specifically, the results of the Wald chi-square would not display when

running the command. I am only able to view the 2-way weighted frequency

table as the only displayed output.

I am actually a beginner in SAS and am not really familiar with the SASHELP

datasets that you have specified. Nevertheless, hopefully you would be able

to provide a solution based on my clarification above. If not, I would

greatly appreciate it if you describe in more detail on the steps involved

to replicate a SASHELP dataset. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yli33

10-20-2017 04:17 PM

Right now you're using your own data,

`data=wdp.newzhang;`

Instead, try using a data set from SASHELP so we can run the code. We can't right now because we don't have your data. Or you can use data from the documentation.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

10-20-2017 04:27 PM

Hi Reeza,

Thank you for responding again. Nevertheless, I do not know whether the SASHELP datasets that you have specified earlier (e.g. class, heart, etc) are survey-based datasets.

Do you just want for me to include the same commands using another dataset using different variables than the ones that I am currently using?

proc surveyfreq data=sashelp.class;

tables sex*lang/wchisq;

weight weight_3;

run;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yli33

10-20-2017 04:30 PM

Sort of. Check your log, are you seeing this message:

**NOTE: Chi-square tests cannot be computed for the table of Sex by**** Age because at least one table cell has 0 frequency.**

NOTE: PROCEDURE SURVEYFREQ used (Total process time):

real time 0.27 seconds

cpu time 0.04 seconds

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

10-20-2017 04:43 PM

Hi Reeza,

Yes, I do see the following comments made on the SAS log.

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 dataset has quite a lot of missing values. Nevertheless, I thought that using weight would have compensated for the missing values by adjusting the data to be more representative of the population. Could you provide a solution to this issue? Thanks!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

10-20-2017 04:12 PM

Actually, I am not even sure if SAS even calculated a wald chi-square statistic and associated p-value, needless to say display the results in the output table. Also, would it be possible for you to inform me on the steps involved to replicate my current issue using a SASHELP dataset. Thanks again!