[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Multi-way contingency tables in Stata

From   Roy Wada <>
To   <>
Subject   RE: st: Multi-way contingency tables in Stata
Date   Tue, 21 Apr 2009 07:24:32 -0700

You can use the -tab- open of -outreg2- to produce a table of 1-way, 
2-way, 3-way, or n-way tabulation.
There is no hard limit on the number of variables that can be crossed.
A  difficulty of producing cross-tabulation is the case of empty
cells. -outreg2- overcomes this difficulty by taking advantage of 
-merge- command.

Yes, you can do a lot with -merge-.

If you want to produce something like a 8-way cross-tabulation, it may
take a while to run. I would suggest you try several variables and work 
your way up.

* example of 4-way tabulation:
sysuse auto, clear
egen mileage=cut(mpg), group(10)
egen paid=cut(price), group(3)
outreg2 mileage paid foreign rep using myfile, see replace tab stats(coef)
outreg2 mileage paid foreign rep using myfile, see replace tab
The current limitation of -tab- option in -outreg2- is that the first 
variable must be counting numbers, i.e. 0, 1, 2, etc., and the rest of
variables must be non-strings.

Strings could possibly be made to go through the label option, but that 
seemed like a overkill.

The -tab- option is not currently documented.

> I want to create a large, multiway contingency table in Stata. I need
> to reduce the table for a latent class analysis in another program.
> However, with the table and tabulate commands in Stata I only have the
> opportunity to cross two variables. With the userwritten command
> tab3way, I can cross three variables. However, I need to cross around
> eight polytomous variables and get the output into a data file / text
> file.
> Can anyone help me with this one?
> All the best,
> Kristian
Rediscover Hotmail®: Get quick friend updates right in your inbox.
*   For searches and help try:

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