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: Format summary table numbers with maximum of one decimal


From   Christoph Schnelle <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Format summary table numbers with maximum of one decimal
Date   Fri, 28 Mar 2014 21:59:31 +0000

Thank you, Phil!

Much appreciated.

Warm Regards,

Christoph


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Phil Schumm
Sent: Saturday, 29 March 2014 8:36 AM
To: Statalist Statalist
Subject: Re: st: Format summary table numbers with maximum of one decimal

On Mar 28, 2014, at 4:23 PM, Christoph Schnelle <[email protected]> wrote:
> I am trying to create a summary with N, mean and sd showing no decimal for = the integer (N) and exactly one decimal for mean and sd in Stata 13 and I am not succeeding.
> 
> The closest I came is with:
> 
> sysuse auto
> tabstat mpg, by(foreign) stat(n mean sd) nototal format(%9.1g)
> 
> foreign |         N      mean        sd
> ---------+------------------------------
> Domestic |        52        20       4.7
> Foreign |        22        25       6.6
> ----------------------------------------


    . table foreign, c(mean mpg sd mpg count mpg) format(%9.1f)

    ----------------------------------------------
     Car type |  mean(mpg)     sd(mpg)      N(mpg)
    ----------+-----------------------------------
     Domestic |       19.8         4.7          52
      Foreign |       24.8         6.6          22
    ----------------------------------------------


-- Phil


*
*   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/

*
*   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