Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: decimal points after tabulate,summarise( )


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: decimal points after tabulate,summarise( )
Date   Fri, 18 Nov 2011 18:21:21 +0000

Change the display format of -var2-. 

. sysuse auto, clear
(1978 Automobile Data)

. tab rep78, su(mpg)

     Repair |      Summary of Mileage (mpg)
Record 1978 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |          21   4.2426407           2
          2 |      19.125   3.7583241           8
          3 |   19.433333   4.1413252          30
          4 |   21.666667   4.9348699          18
          5 |   27.363636   8.7323849          11
------------+------------------------------------
      Total |   21.289855   5.8664085          69

. d mpg

              storage  display     value
variable name   type   format      label      variable label
--------------------------------------------------------------------------
mpg             int    %8.0g                  Mileage (mpg)

. format mpg %4.2f

. tab rep78, su(mpg)

     Repair |      Summary of Mileage (mpg)
Record 1978 |        Mean   Std. Dev.       Freq.
------------+------------------------------------
          1 |       21.00        4.24           2
          2 |       19.13        3.76           8
          3 |       19.43        4.14          30
          4 |       21.67        4.93          18
          5 |       27.36        8.73          11
------------+------------------------------------
      Total |       21.29        5.87          69

Nick 
n.j.cox@durham.ac.uk 

Nikolaos Pandis
 
Is there a way to limit the decimal after the command:
tabulate var1,summarise(var2)

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index