BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

I have a table that has multiple rows but within the table I have 2 columns. 1 is NoReadm and the other YesReadm

The no has 0 and the Yes has 1. There are 774 rows in all. 39 of those rows have the 1 and the rest are 0. I want a chi square and am doing the following code off the table.

proc freq data = readm..final

tables noreadm * yesreadm/chisq;

run;

I am getting the output the freq procedure table of noreadm and yesreadm effective sample size = 0

frequency missing =774

Not sure what that means or how to fix this

6 REPLIES 6
PGStats
Opal | Level 21

Not sure I understand your question. Is there a fixed relationship between NoReadm and YesReadm?

PG

PG
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

Not sure what you mean by fixed relationship. Do I need to add the two columns together somehow to get 774? Like have a column that is noreadm that has the 0 then yesreadm that has the 1 and then another column that maybe is count or something that houses the 0 and the 1's?

PGStats
Opal | Level 21

Chi square tests whether there is a relation between two characteristics. For instance, if having NoReadm=1 changes the probability of having also YesReadm=1. Is this the kind of thing you are trying to test?

PG
SteveDenham
Jade | Level 19

I'll follow on to PGStats question.  I think for any record you have either (noReadm=0, yesReadm=1) or (noReadm=1, yesReadm=0).  If that is the case, what other characteristic would drive this?  Without another characteristic, the probability of noReadm=0 is exactly that of yesReadm=1, and is exactly equal to 1 minus the probability of noReadm=1 (and 1 minus the probability of yesReadm=0).  A second characteristic would lead to a 2 x 2 or a 2 x k table.

If you want to test whether the proportion of noReadm is equal to a fixed value, you can do that with:

proc freq data=yourdata;

tables noReadm/chisq testp=0.5;

run;

This would test if the proportion of noReadm in your sample is equal to 0.5, using a chi-squared test.

Steve Denham

Doc_Duke
Rhodochrosite | Level 12

tmm,

Maybe you could show a snippet of your data.  I suspect that you may also have a data coding issue going on.  In the yesreadm variable, it is coded 1 if there is a readm present.  What is yesreadm coded if readm is NOT present.  If it is coded with a null ("."), that may be the heart of the matter and you need to add the MISSING option to the code that Steve posted last.  The MISSING option treats nulls as valid values for the computation of the test.

Doc Muhlbaier

Astounding
PROC Star

Key questions (perhaps overlapping with the comments of others) ...

When you look at  NOREADM and YESREADM individually, how often are they missing?  Do they have any formats connected with them?

That should be enough to make the answer obvious.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1228 views
  • 0 likes
  • 5 in conversation