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.
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.
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.
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;
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
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!
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.