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   Phil Schumm <[email protected]>
To   Statalist Statalist <[email protected]>
Subject   Re: st: Format summary table numbers with maximum of one decimal
Date   Fri, 28 Mar 2014 16:35:32 -0500

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/


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