02-29-2012 02:27 PM
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;
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
02-29-2012 02:37 PM
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?
02-29-2012 02:43 PM
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?
02-29-2012 03:13 PM
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;
This would test if the proportion of noReadm in your sample is equal to 0.5, using a chi-squared test.
02-29-2012 03:33 PM
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.
02-29-2012 04:03 PM
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.