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: reversible -destring-, precision, longs v doubles


From   László Sándor <[email protected]>
To   [email protected]
Subject   st: reversible -destring-, precision, longs v doubles
Date   Tue, 6 Aug 2013 12:03:42 -0400

I ran into an error with identifiers longer than -maxlong()- before
(blame statistical offices fond of 10 digits or more). So now I wanted
to be careful while destringing, but you cannot specify the type for
the result — however, -destring- breaks if the process is not
"reversible." What does it mean exactly? I cannot find it documented.
(Actually, the default type for -destring- is double, so it is surely
not the case the destring only produces longs unless forced to.)

Do I need to worry about my identifiers becoming imprecise or rounded
if -destring- did not warn me?

The documentation of -tostring- does contain the following, but this
is not exactly the same thing.

Conversion of numeric data to string equivalents can be problematic.
Stata, like most software, holds numeric data to finite precision and
in binary form. See the discussion in [U] 13.11 Precision and problems
therein. If no format() is specified, tostring uses the format %12.0g.
This format is, in particular, sufficient to convert integers held as
bytes, ints, or longs to string equivalent without loss of precision.
However, users will often need to specify a format themselves,
especially when the numeric data have fractional parts and for some
reason a conversion to string is required.

Thanks!

*
*   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