Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: floats to double


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: floats to double
Date   Sat, 12 Oct 2002 14:15:10 +0100

Kompal Sinha 

> I have converted a 15 digit string into a numerical number 
> by using real()
> command. My problem is that now the data is read as floats 
> while I want it
> to be in doubles as the string happens to be the caseId of 
> my data. How do I proceed??

Antoine Terracol

> try using -destring- (Stata 7) instead of real()

There is a fairly lengthy discussion of numbers 
and strings in Stata Journal 2(3), 314-329, 
which focuses on when to use numbers and when 
to use strings, on -encode- and -decode-, 
-real()- and -string()-, and -destring- 
and -tostring-. 

I ask, in response, if the variable in 
question is an identifier why do 
you want to convert it to numeric? Do you 
want to do calculations with it? 
In most cases I have heard of there 
is no gain in converting identifiers
to numeric, even when all the characters
are numeric. 

Nick 
[email protected] 
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index