I am encountering an issue that seems to be trivial, but so far I have not found a solution and several posts in this forum could not help:
I imported data from excel that contains cells with very long decimals, for instance 19.464398743793332. When I first destring the variables in STATA, they are automatically stored in the scientific format (e.g. 1.94e-16).
So far, I have simply not found out how I could round these numbers off, or just display them in a rounded format. Neither something like
Code:
gen value1_new = round(value1, 0.01)
Code:
gen value1_new2 = value 1 format value1_new2 %16.2f
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double value1 str17 value2 float(value1_new value1_new2) . "19.9958939998468" . . 1994506003 "2106108788.4" 1994505984 1994505984 1994109003 "2105711788.4" 1994109056 1994109056 199364246972543 "2202037379.66668" 1.9936424e+14 1.9936424e+14 . "12403617031.1715" . . 329069794229935 "38.8560613126543" 3.290698e+14 3.290698e+14 22937260873 "2874058234.3" 22937260032 22937260032 19563967873 "2487128423.3" 19563968512 19563968512 375534994458024 "3438619106.27153" 3.75535e+14 3.75535e+14 129361584607353 "11851853961.071" 1.293616e+14 1.293616e+14 367571998616128 "5.4559588978817" 3.67572e+14 3.67572e+14 3108453055 "2883679090.4" 3108453120 3108453120 9.247447612e+15 "955602845.3" 9.247448e+15 9.247448e+15 8665486245366631 "52860813856.1447" 8.665486e+15 8.665486e+15 169777451612066 "135893483715.184" 1.6977746e+14 1.6977746e+14 end
Many thanks in advance!
0 Response to Rounding off long decimals after importing from excel
Post a Comment