Announcement

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

  • display all significant digits after total or display for width greater than 9

    Dear Statalist,

    I am using Stata 14 trying to display all significant digits after the -total- or -display- command. For -total-, cformat is limited to a width of 9, so I cannot display a whole number above 999,999,999. I found a workaround using:

    summary x
    return list
    display r(N) * r(mean)

    But couldn't get -display- to report the whole number, so had to paste the r(N) and r(mean) values into excel and multiply. Is there a way to display the whole number internally in Stata?

    Thanks,
    Brent Fulton

  • #2
    First, there is no -summary- command, it's -summarize-. More generally, when posting code here it is important to post exactly what you ran--little details are often critical to troubleshooting. The way to be sure you post exactly what was run is to use copy/paste directly from Stata's results window into a code block here on this Forum--and then don't edit it at all. (If you are not yet familiar with code blocks, read FAQ #12 for instructions.)

    Turning to your question, you can indeed format the output of -display- to your taste. Here's an example:

    Code:
    . sysuse auto
    (1978 Automobile Data)
    
    . replace price = 4321*price
    variable price was int now long
    (74 real changes made)
    
    . summ price
    
        Variable |        Obs        Mean    Std. Dev.       Min        Max
    -------------+---------------------------------------------------------
           price |         74    2.66e+07    1.27e+07   1.42e+07   6.87e+07
    
    . display `r(sum)'
    1.971e+09
    
    . display %12.0f `r(sum)'
      1971365509
    You can use any valid Stata format in the -display- command. Do read the manual section on -display- to learn more about its very flexible capabilities.

    Comment


    • #3
      Hi Clyde,
      Thank you for the helpful response....I got sidetracked on another project and am returning to this.
      I used your advice.
      It also worked for displaying a matrix e.g.,
      matrix list mresult1, format(%12.0f)
      Thank you,
      Brent Fulton

      Comment

      Working...
      X