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: Re: st: Descriptive statistics table for continuous variables by several subgroups


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: Re: st: Descriptive statistics table for continuous variables by several subgroups
Date   Thu, 13 Mar 2014 20:08:44 +0000

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 ).  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/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