Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Formatted 3-way tables


From   Eric Booth <[email protected]>
To   [email protected]
Subject   Re: st: Formatted 3-way tables
Date   Mon, 26 Mar 2012 09:03:58 -0500

<>

Hi Rick:


> But I would like column percentages, a "total" column (i.e. smokes yes
> or no, regardless of race). 


Take a look at -tab3way- it has the total and percentage options you describe.  

Also, in terms of exporting these tables  (like -tabout- does) you could also:
a) use -contract- to build your tables  and then export it using -outsheet- or -export excel- 
OR 
b) use -logout- to directly export a -table- or -tab3way- command.

(-logout-, -tabout-, and -tab3way- are from SSC)

>  I have looked in the manual for -tabout-
> but I haven't seen any solution there. I understand that I can
> generate new variables that give all categories and then use
> -tabulate-, but I have to generate a great number of tables so it
> isn't a feasible way.

You should look into -forvalues- or -foreach- looping because it can make the process of creating the combined variable (btw, I suggest using -egen- function -group()- for this) and many  N-way -tabout- tables very feasible.  One way to approach this process is already spelled out on pages 35/37 of Watson's -tabout- guide:   http://www.ianwatson.com.au/stata/tabout_tutorial.pdf


- Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754


On Mar 26, 2012, at 3:46 AM, Richard Moverare wrote:

> Dear Statalist,
> 
> I guess this could be solved in some neat way, but I haven't found
> anysolution. I would like to create 3-way tables that looks something
> like:
> 
> webuse byssin
> table workplace smokes race, row
> 
> But I would like column percentages, a "total" column (i.e. smokes yes
> or no, regardless of race). I have looked in the manual for -tabout-
> but I haven't seen any solution there. I understand that I can
> generate new variables that give all categories and then use
> -tabulate-, but I have to generate a great number of tables so it
> isn't a feasible way. This is such a basic feature in all other
> statistical softwares, so I assume there is some easy solution I
> haven't found. Any help would be greatly appreciated.
> 
> All the best,
> Rick M.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index