Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

Reply
Occasional Contributor
Posts: 19

Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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.

 

proc surveyfreq data=wdp.newzhang;
 
tables sex*lang / wchisq;
 
weight weight_3;
 
run;
 
Best,
Lisa
Super User
Posts: 20,236

Re: Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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.

Occasional Contributor
Posts: 19

Re: Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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!


Super User
Posts: 20,236

Re: Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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.

Occasional Contributor
Posts: 19

Re: Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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;

Super User
Posts: 20,236

Re: Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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

Occasional Contributor
Posts: 19

Re: Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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!

 

Occasional Contributor
Posts: 19

Re: Dilemma: Conducting Wald Chi-Square Test Using Proc Surveyfreq Statement on SAS 9.4

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!
Ask a Question
Discussion stats
  • 7 replies
  • 82 views
  • 0 likes
  • 2 in conversation