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: summarizing by more than one grouping variable


From   Eric Booth <[email protected]>
To   [email protected]
Subject   Re: st: summarizing by more than one grouping variable
Date   Tue, 27 Mar 2012 15:25:29 -0500

<>

Here's some examples:
*********
webuse lbw, clear

*1.
bys race smoke: su age

*2.
tab race smoke, summarize(age) mean

*3.
preserve
collapse (mean) age, by(race smoke)
list
restore
*********

- Eric

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

On Mar 27, 2012, at 2:19 PM, Lars Folkestad wrote:

> I cannot see my way out of this. There is probably a simple solution.
> 
> I want to summarize my data using two fx sex and type.
> 
> Normally i would use:
> by type, sort: summarize var1, d
> 
> To summarize the variable var1 for each type (or group if you like).
> 
> I would like to see the mean for type1 and female sex, and type1 and male sex and type2 and female sex and type2 male sex.
> 
> lars
> 
> *
> *   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