Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: create a contingency table


From   Jean-Benoit Hardouin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: create a contingency table
Date   Tue, 04 Nov 2003 23:48:56 +0100

dear statalisters,
I search a method to transform a data as :
Item1 Item2 Item3 Item4 0 0 1 2 1 3 0 1
3 0 2 1

(table of the responses of individuals to four items) in
Item1 Item2 Item3 Item4 Count
0 0 0 0 125
0 0 0 1 88
0 0 0 2 72
0 0 0 3 52
0 0 1 0 28
0 0 1 1 65
0 0 1 2 42
...

where 125 is the number of individuals who have respond 0 to each item, 88 is the number of individuals who have respond 0 to the first three item and 1 to the last item, etc.

I don't find how to obtain this kind of table with "reshape" or "egen" (for example).

I have idea to program that with four "forvalues..." but perhaps it exist a specific command.

Thank you for your help

Jean-Benoit Hardouin,
Regional Health Observatory, Orléans, France *
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index