Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to produce tables with rounded numbers in the Results window?

    I would like for numbers displayed in Stata's Results window to be rounded. To use an example, I'm examining data on exam scores (exam5) among students in two different sections (sect) of a course. Here is the default table produced when using the "tabstat" command: [mess.jpg]

    Click image for larger version

Name:	mess.jpg
Views:	1
Size:	63.5 KB
ID:	1499040


    I do not need or want all of that detail for the mean and sd. I do not need to know the mean exam5 score down to the hundred thousandth decimal place! I'd like to for Stata to present in the Results window by default a table that looks like the one below: [better.jpg]

    Click image for larger version

Name:	better.jpg
Views:	1
Size:	51.8 KB
ID:	1499039


    The only differences between the two tables are in the detail provided in the mean and sd columns. How can I get Stata to produce values in these columns that are rounded to one (or two, etc.) decimal place? Thank you for any help or feedback you're able to provide!

    -Nick Parsons





  • #2
    Welcome to Statalist.

    In the output of help tabstat, you will find the format() option, which will help you in this case.
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . tabstat length weight
    
       stats |    length    weight
    ---------+--------------------
        mean |  187.9324  3019.459
    ------------------------------
    
    . tabstat length weight, format(%9.1f)
    
       stats |    length    weight
    ---------+--------------------
        mean |     187.9    3019.5
    ------------------------------

    Comment


    • #3
      I'm just noticing your reply now. Thank you very much, William!

      Comment

      Working...
      X