Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: RE: Tostring (string from a numerical variable) |

Date |
Wed, 17 Mar 2010 16:55:10 -0000 |

I don't support Martin's advice, although the help does flag it as one possibility. Carmen's need is rather to focus on why you get this error message. Carmen's real problem must be other than stated. Negative signs can be mapped to "-" characters without loss of information. The most likely problem is that the variable has a fractional part that would not be preserved exactly under -real(string())-. That's the key idea of -tostring- and is what distinguishes it from the testosterone-driven brute force application of -string()-. If that's true, the question is why is converting that to string being considered. If that's not true, or even if it is, more information about the data is needed to give better advice. Nick n.j.cox@durham.ac.uk Martin Weiss Use the -force- option, risking information loss. Although negative numbers as such do not seem to pose much of a problem for my Stata 11: ************* clear* inp x -1 -2 0 3 4 5 end tostring x, generate(strx) l ************* carmen gamarra [edited] I want to generate a variable string from a numerical variable that has negative sign (in front of the number). Is this possible? Because Stata gives me the following message. (tostring var_1, generate( var_1str)) var_1 cannot be converted reversibly; no generate. What must I do? * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Getting string variable values on graph***From:*Jibonayan Raychaudhuri <jibonayanrc@yahoo.com>

**st: RE: Getting string variable values on graph***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: RE: RE: Getting string variable values on graph***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**st: RE: RE: RE: Getting string variable values on graph***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**st: RE: RE: RE: RE: Getting string variable values on graph***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: Tostring (string from a numerical variable)***From:*carmen gamarra <carmengamarra@hotmail.com>

**st: RE: Tostring (string from a numerical variable)***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**Re: st: Graph png format - differences in scaling between vers. 10 and 11** - Next by Date:
**Re: st: Tostring (string from a numerical variable)** - Previous by thread:
**st: RE: Tostring (string from a numerical variable)** - Next by thread:
**st: RE: RE: Tostring (string from a numerical variable)** - Index(es):