Programming the statistical procedures from SAS

Chi Squared with Observations and Summarized Data

Reply
New Contributor
Posts: 2

Chi Squared with Observations and Summarized Data

Hey everyone,

I have a data set with quite a few obersvations. I need to test non-response bias based on a previous study using a chi-squared test; however, I don't have access to the actual observations of the previous study, just the summarized totals for everything. Is there a way to compare summarized data with raw data in SAS?

Thanks for the help!

Esteemed Advisor
Posts: 7,085

Chi Squared with Observations and Summarized Data

If you weren't limited to just chi-square tests, I have found the following macro to be quite helpful:

http://www.datavis.ca/sasmac/stat2dat.html

Conversely, you could always write a small datastep to expand the aggregate file back to its original state.

New Contributor
Posts: 2

Chi Squared with Observations and Summarized Data

That is a very useful macro that I'll have to remember. Unfortunatley, the data wouldn't lend itself to that as it is only frequencies.

SAS Super FREQ
Posts: 3,317

Chi Squared with Observations and Summarized Data

You can either expand the summary data, or use PROC FREQ to summarize the observed data. For this situation, I'd suggest summarizing the new data by running PROC FREQ on the new observations; see the 2nd example of

http://blogs.sas.com/content/iml/2011/09/19/count-the-number-of-missing-values-for-each-variable/

Then you can use a short DATA step to consolidate the old summary and the new summary, and use PROC FREQ with a WEIGHT statement to take the frequencies into account when you do the chi-square test.

Ask a Question
Discussion stats
  • 3 replies
  • 97 views
  • 0 likes
  • 3 in conversation