Announcement

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

  • Univar command, median is showing scientific notation, need full numeric form

    Hello,

    I am trying to view the median value of many sums of dollar amounts. To do this easily without using the sum varname,detail long process, I installed the univar command. However, with values over $1,000,000 under the median column, I can only see them in scientific notation. Anyone know how to view the full value?

    The command I used was: univar sumTotal1962 sumTotal1963 ... all the way to sumTotal2018



  • #2
    As you do not provide example data to work with, the following code is untested and may contain errors or fail to work with your data:

    Code:
    foreach v of varlist sumTotal* {
        display "`v'"
        quietly centile `v', centile(50)
        display %12.0fc `r(c_1)'
    }
    In the future, when asking for help with code, please use the -dataex- command to show example data. If you are running version 15.1 or a fully updated version 14.2, it is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment


    • #3
      Thank you Clyde for the advice, it worked. Just another question, how can I view the decimal values as well? It is rounding the numbers to the nearest whole number now. And I will post my code from now on! Appreciate the advice.

      Comment


      • #4
        So, if, say, you want two decimal places, change %12.0fc to %14.2fc.

        Comment

        Working...
        X