## 0 obs with chi square

Regular Contributor
Posts: 238

# 0 obs with chi square

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

Esteemed Advisor
Posts: 5,526

## 0 obs with chi square

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

PG

PG
Regular Contributor
Posts: 238

## 0 obs with chi square

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?

Esteemed Advisor
Posts: 5,526

## 0 obs with chi square

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
Respected Advisor
Posts: 2,655

## 0 obs with chi square

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

Trusted Advisor
Posts: 2,125

## 0 obs with chi square

Posted in reply to SteveDenham

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

Super User
Posts: 6,762

## 0 obs with chi square

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.

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