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]

Aw: RE: Re: st: Descriptive statistics table for continuous variables by several subgroups


From   "Marie-Luise Schmitz" <[email protected]>
To   [email protected]
Subject   Aw: RE: Re: st: Descriptive statistics table for continuous variables by several subgroups
Date   Thu, 13 Mar 2014 22:04:42 +0100

Dear Joe, dear Nick,
 
thank you both very much for helping.

The objective of this exercise is indeed to prepare a Diff-in-Diff analysis by graphical means and to later calculate the ATE.
An approximation to a solution may be the following but I doubt this is applicable to supercolumns as years in my case.
 
---------------------------------------------------------------
sysuse auto
by foreign: eststo: quietly estpost summarize price mpg rep78, listwise
esttab, cells("mean sd") label nodepvar
---------------------------------------------------------------

Maybe calculating the descriptive statistics "by hand" and taking the time to build a table in Latex is the fastest solution for now. 





Gesendet: Donnerstag, 13. März 2014 um 21:22 Uhr
Von: "Joe Canner" <[email protected]>
An: "[email protected]" <[email protected]>
Betreff: RE: Re: st: Descriptive statistics table for continuous variables by several subgroups
Nick,

Thanks, the use of the s() and c() options (your 2nd and 3rd examples) certainly gets a little closer (and I think that's what Marie-Luise wanted as well). But the problem comes when adding the by() option:

. tabstat turn trunk length, s(n mean SD) c(s) by(foreign)

Summary for variables: turn trunk length
by categories of: foreign (Car type)

foreign | N mean sd
---------+------------------------------
Domestic | 52 41.44231 3.967582
| 52 14.75 4.306288
| 52 196.1346 20.04605
---------+------------------------------
Foreign | 22 35.40909 1.501082
| 22 11.40909 3.216906
| 22 168.5455 13.68255
---------+------------------------------
Total | 74 39.64865 4.399354
| 74 13.75676 4.277404
| 74 187.9324 22.26634
----------------------------------------

Not only is this not what is wanted, but there are no longer any variable labels for the continuous variables. Granted, trying to arrange the by() variables in columns could be a nightmare if there are more than a few levels, but it seems like it should still be an option, with either a restriction on the number of levels, or the user being held responsible for being careful about not specifying too many levels.

Are you aware of any alternatives to -tabstat- that do this?

Regards,
Joe

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Thursday, March 13, 2014 4:09 PM
To: [email protected]
Subject: Re: Re: st: Descriptive statistics table for continuous variables by several subgroups

Variables on rows, statistics on columns can mean different things,
but for those interested consider

. sysuse auto, clear
(1978 Automobile Data)

. tabstat turn trunk length, s(n mean SD)

stats | turn trunk length
---------+------------------------------
N | 74 74 74
mean | 39.64865 13.75676 187.9324
sd | 4.399354 4.277404 22.26634
----------------------------------------

. tabstat turn trunk length, s(n mean SD) c(s)

variable | N mean sd
-------------+------------------------------
turn | 74 39.64865 4.399354
trunk | 74 13.75676 4.277404
length | 74 187.9324 22.26634
--------------------------------------------

. tabstat turn trunk length, s(n mean SD) c(s) format(%2.1f)

variable | N mean sd
-------------+------------------------------
turn | 74.0 39.6 4.4
trunk | 74.0 13.8 4.3
length | 74.0 187.9 22.3
--------------------------------------------

The detail that sample size follows the same format as everything else
needs fixing downstream at some point.
.
Nick
[email protected]


On 13 March 2014 20:01, Joe Canner <[email protected]> wrote:

> This is an unfortunate omission from the otherwise very useful -table-, -tabstat-, and -tabout- commands. There have been several suggested solutions in the past, all of which involve producing a table in the usual way and transposing it, either using Stata matrices (http://www.stata.com/statalist/archive/2006-08/msg00335.html ) or MS Excel (http://www.stata.com/statalist/archive/2005-07/msg00040.html[http://www.stata.com/statalist/archive/2005-07/msg00040.html] ). I don't know if there are any more recent suggestions, but I would love to know about them if there are, as what you are trying to do is something that frequently comes up in biomedical research (e.g., list of means for all continuous variables, stratified by treatment group).

Marie-Luise Schmitz

> I studied that document at length and I highly appreciated it. The problem is that it treats only the case where the rowvariable is categorial. I don't see what to do if the rowvariable is continuous. I would like to have the table with the variables defining rows and the groups (years; all north south) defining columns.

> Von: "Michael McCulloch" <[email protected]>

> Marie, the Tabout program can do this, and shows how to implement in LaTex. Ian Watson's tutorial paper is easily located via google.

>> I want to produce a table of descriptive statistics (mean values) for several continuous variables for different subgroups and years. Basically, I want to obtain a table that looks as follows:
>>
>> 2006 2007 2008
>> variable all north south all north south all north south
>> var_1
>> var_2
>> var_3
>> N. obs.
>>
>> I would like to export this table into Latex afterwards which might further complicate things.
>>
>> I tried several things using the tabulate command but nothing worked because my rowvariables are not categorial.

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

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

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


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