Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: real vs destring


From   Nicholas Harrigan <nicholas.harrigan@nuffield.ox.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: real vs destring
Date   Fri, 04 Apr 2008 15:10:20 +0100

Hello,

I am trying to recode a variable containing large numbers which are currently held as strings.

I am wondering why real and destring give different results

"5560001090"
when I run real I get: 5560001024 when I run destring I get: 5560001090

"5560001108"
when I run real I get: 5560001024 when I run destring I get: 5560001108

Does this mean I should use always use destring in my coding instead of real?

The commands I use are these:

gen new_var = real(old_var)
gen new_var2 = old_var
destring new_var2, replace

Best
Nick


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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   |   What's new   |   Site index