BookmarkSubscribeRSS Feed
yli33
Fluorite | Level 6
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
7 REPLIES 7
Reeza
Super User

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.

yli33
Fluorite | Level 6
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!


Reeza
Super User

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.

yli33
Fluorite | Level 6

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;

Reeza
Super User

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

yli33
Fluorite | Level 6

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!

 

yli33
Fluorite | Level 6
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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 582 views
  • 0 likes
  • 2 in conversation