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]

[no subject]



Still, it is a bit scary to risk rounding your identifiers by a
mistaken float somewhere. On the other hand, string identifiers cannot
be panel IDs for xtset, so I need to bite the bullet.

Thanks again,

Laszlo

On Tue, Aug 6, 2013 at 12:29 PM, Nick Cox <[email protected]> wrote:
> I guess I wrote some zeroth version of that.
>
> Conversion is reversible if real(string(<original>)) = <original> or
> string(real(<original>)) = <original> where <original> is whatever you
> feed in and -string()- can use whatever format is specified.
>
> What this amounts to is a stipulation is that you must lose no
> information, crucial if you change your mind about what should be done
> to the data.
>
> So, a reversible potato peeler or university education would restore
> the potatoes or the students to their original state.
> Nick
> [email protected]
>
>
> On 6 August 2013 17:03, László Sándor <[email protected]> wrote:
>> 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 �nite precision and
>> in binary form. See the discussion in [U] 13.11 Precision and problems
>> therein. If no format() is speci�ed, tostring uses the format %12.0g.
>> This format is, in particular, suf�cient 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/
>
> *
> *   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