Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Decimal Precision with Destring


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Decimal Precision with Destring
Date   Mon, 19 Apr 2010 07:44:21 -0700 (PDT)

--- On Mon, 19/4/10, Sutton, Bennett W. wrote:
> I am insheet-ing a .csv file with decimal precision set at
> 15 places in excel.  But after insheeting into stata,
> the series are data type double, but only have precision to
> 10 places.  I'm working with hyperinflation countries
> and the lack of precision is producing some incorrect
> results in calculations.

In the example below, -insheet- results in a precision of 
15 digits that you require. Maybe something went wrong in the
conversion from Excel to .csv?

*--------- begin example -----------
clear
input double x
123456789012345
end
format x %20.15g
di %20.15g x

tempfile a
outsheet using `a'

clear
insheet using `a'

di %20.15g x
*----------- end example -----------

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index