Announcement

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

  • Descriptive stst./large numbers

    Hi,
    I have a problem of large numbers when I run descriptive statistics, for instatnce firm size 254154000, Stata gave me unexplainable value. see the following:

    tabstat realsize, statistics( mean min max sd skewness kurtosis ) by(year)

    Summary for variables: realsize
    by categories of: year (Year)

    year | mean min max sd skewness kurtosis
    ---------+------------------------------------------------------------
    2009 | 6.81e+07 2448000 8.86e+08 1.28e+08 3.846879 20.11333
    2010 | 6.94e+07 2142000 1.01e+09 1.46e+08 4.368231 23.97287
    2011 | 7.79e+07 1917000 1.30e+09 1.93e+08 4.955953 28.7557
    2012 | 8.00e+07 1920000 1.53e+09 2.00e+08 5.20318 32.6029
    2013 | 8.58e+07 1887000 1.80e+09 2.25e+08 5.505829 36.50395
    2014 | 8.50e+07 1692000 1.77e+09 2.23e+08 5.421786 35.31947
    ---------+------------------------------------------------------------
    Total | 7.77e+07 1692000 1.80e+09 1.89e+08 5.468645 37.8283

  • #2
    Jo:
    the problem you reported has to do with the way Stata displays values, not the way it stores them.
    For further details, please see -help format-
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks Carlo,
      I tried but still struggling.
      Any further hints - the problem is with firm size variable which is represented in large monetary value.

      Comment


      • #4
        Hi Jo,

        I admit I am a bit confused at your question. Are you saying that the values are wrong? or that you don't want to see them in scientific notation? (or something else?)

        Comment


        • #5
          thanks Joshua
          The problem mainly is when I import my data from excel, the large numbers appears e.g. like this 6.81e+07 not the normal number which is e.g 42139000

          Comment


          • #6
            this could be a display issue or it could be a precision issue; regardless, it is best to import such large numbers as strings and then to determine how you want to deal with them in Stata

            Comment


            • #7
              Jo,

              Spend some time reading -help format- and [D] format. Number like 6.81e+07 are not "unexplainable." They are shown in scientific notation: it means 6.81 times 10 to the 7th power. When Stata imports data, it has some defaults as to what display formats it uses. You can control that with the -format- command. So if you want var1 to look like 42139000 instead of 4.21e+07 you can specify -format var1 %8.0f- and then when you -list- or -browse- those are the numbers you will see.

              Not all of Stata's commands automatically respect the format you specify. The example you showed originally is output from -tabstat-. That command does not take note of the format you specify with the -format- command. But it does have a -format()- option of its own which will let you control how its output looks. If you try -tabstat realsize, statistics( mean min max sd skewness kurtosis ) by(year) format(%8.0f)- you will get output in the format you are looking for. Most commands that show data will either respect what you have done with -format- or have some option or other mechanism (e.g. the -set cformat- and related commands for regression output) for specifying the format you want.

              Also, bear in mind that all that the -format- command, or -format()- options in other commands do is modify the way Stata shows the data. The actual number maintained in memory or in the disk file is not affected by these formats. It is a binary representation in any event (and in the unlikely event you ever want to see what that looks like, you can get a rough sense of it with format %21x).

              Comment


              • #8
                Dear Clyde,
                It now works , much appreciated your valuable comments.
                Thanks very much.

                Comment

                Working...
                X