Announcement

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

  • Convert Scientific Notations (e-07) into Decimal Notation

    Hi All,

    I have various observations in my dataset like- 1.40e+09, 1.57e-07.

    How to convert these scientific notations into decimal notations?

  • #2
    Nihar:
    see -help format-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      HI Carlo,

      I read the document. Thankyou!

      I used the following command- tostring bse_firm_specific_volatility, generate(bse_firm_specific_volatility1) format (%9.0g). But erroe: "bse_firm_specific_volatility cannot be converted reversibly" is coming.

      Comment


      • #4
        You should not be converting your numeric data to strings. You should simply change the format used to display them.
        Code:
        . describe euros
        
        Variable      Storage   Display    Value
            name         type    format    label      Variable label
        ------------------------------------------------------------------------------------------------
        euros           double  %10.0g                
        
        . list
        
             +-----------+
             |     euros |
             |-----------|
          1. | 1.401e+09 |
             +-----------+
        
        . format %12.0f euros
        
        . describe euros
        
        Variable      Storage   Display    Value
            name         type    format    label      Variable label
        ------------------------------------------------------------------------------------------------
        euros           double  %12.0f                
        
        . list
        
             +------------+
             |      euros |
             |------------|
          1. | 1401234567 |
             +------------+
        Another approach which is often helpful with financial data is to convert it from, for example, euros to millions of euros.
        Code:
        . generate euros_m = euros / 1000000
        
        . describe euros_m
        
        Variable      Storage   Display    Value
            name         type    format    label      Variable label
        ------------------------------------------------------------------------------------------------
        euros_m         float   %9.0g                 
        
        . list euros_m
        
             +----------+
             |  euros_m |
             |----------|
          1. | 1401.235 |
             +----------+

        Comment


        • #5
          Thank you William. Changing the format of the display worked.

          Comment

          Working...
          X