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

Re: st: n-way tabulation


From   wgould@stata.com (William Gould, Stata)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: n-way tabulation
Date   Tue, 01 Nov 2005 07:48:59 -0600

Lawrence Hanser <lhanser@gmail.com> asked

> Is it possible to do greater than two-way cross-tabulations?  For
> example, if I have religion (10 categories), gender (2 categories),
> age (4 categories), and ethnicity (6 categories), is there a simple
> command to get the counts for each of the 480 cells?

Joseph Coveney <jcoveney@bigplanet.com> suggested

	. preserve
	. contract religion gender age ethnicity
	. list, noobs separator(0)
	. restore

Anotehr possibility is 

	. table age ethnicity gender, by(religion)

-table- produces tabular output, which Lawrence may prefer.  -table-, however,
does not generalize beyond 4-way tables, as Joseph's solution does.

-- Bill
wgould@stata.com
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index