Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Stata 12 MP rounds off large double value on read


From   Kieran McCaul <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Stata 12 MP rounds off large double value on read
Date   Tue, 9 Jul 2013 13:14:39 +0800

...

See -help datatypes-
Double precision has 16 digit accuracy

You have 19 digits.



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Golyaev, Konstantin
Sent: Tuesday, 9 July 2013 10:26 AM
To: [email protected]
Subject: st: Stata 12 MP rounds off large double value on read

Dear Stata gurus,

I am trying to read a plain-text tab-delimited file from disk into Stata with the *insheet* command. There are three lines in the file that cause me trouble, and their values are:

9223 3720 3461 9058 931
9223372034619059031
9223372034619058731

The *insheet* command converts these to *double* storage type, and rounds each of these values to the same number: 9223372034619059200. I am puzzled as to what may be the underlying issue. Moreover, when I try to issue the following command:

generate double x = 9223372034619058931

I get the variable *x* with all values being equal to 9223372034619059200, again.

I have found a workaround by forcing Stata to read these numbers in as strings. But I would like to try to avoid this because of storage inefficiencies. 

Does anyone have any ideas what may be causing this behavior?

Thank you,

Konstantin Golyaev
Economist, Amazon.com
[email protected]


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index