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

st: RE: tostring question


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: tostring question
Date   Mon, 2 Aug 2004 18:24:07 +0100

This depends on what you are looking for and what the data
are like. Note that the display format of the numeric 
variable you are trying to convert is 
irrelevant unless you use the -usedisplayformat- 
option. 

The most relevant part of the help is probably 
this: 

-force- specifies that conversions entailing loss 
of information may be forced.  Loss of
information means one of two circumstances:  (1) The result of real(string(varname,
"format")) is not equal to varname, i.e. the conversion is not reversible without
loss of information.  (2) replace was specified but a variable has associated value
labels.  In circumstance (1), it is usually best to specify usedisplayformat or
format().  In circumstance (2), value labels will be ignored in a forced
conversion.  Note also decode as the standard way to generate a string variable
based on value labels.

Nick 
n.j.cox@durham.ac.uk 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of 
> R.E. De Hoyos
> Sent: 02 August 2004 18:15
> To: statalist@hsphsun2.harvard.edu
> Subject: st: tostring question
> 
> 
> I am trying to transform a numeric variable (double %10.0g) 
> into string
> using -tostring-, however I get the following outcome:
> 
>  tostring folio, gen(sfolio)
> folio cannot be converted reversibly; no generate
> 
> When I try the same command with a similar variable (long 
> %12.0g) -tostring-
> works fine.
> 
> Is there a way to get the string variable I am looking for?
> 
> Thanks,
> 
> Rafa
> *
> *   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/
> 

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