Statalist


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

Re: st: Re: gen a_n = real(a) does not create any values


From   "Sergiy Radyakin" <[email protected]>
To   [email protected]
Subject   Re: st: Re: gen a_n = real(a) does not create any values
Date   Fri, 19 Sep 2008 15:38:48 -0400

Hello Fabian,

real() is perfectly valid and should work.

It will properly handle spaces, e.g. real("   5   ") is 5, but it will
not handle other non-numeric characters, except decimal separator,
plus and minus signs (any other exceptions?). So one explanation is
that the string representation of a number contains an unprintable
non-numeric character, like a tabulation:

. di real(char(9)+"5")
.

also try -browse, nol- to see if labels are somehow involved

And clarify, how do you know that values are generated if you don't see them?

Regards,
  Sergiy Radyakin

On Fri, Sep 19, 2008 at 2:28 PM, Martin Weiss <[email protected]> wrote:
> string to numeric is usually accomplished via -destring-
>
> Martin Weiss
> _______________________
> ----- Original Message ----- From: "Fabian Brenner" <[email protected]>
> To: <[email protected]>
> Sent: Friday, September 19, 2008 8:25 PM
> Subject: st: gen a_n = real(a) does not create any values
>
>
>> Dear all:
>>
>> I use Stata 8 and in order to add two variables a+b (a is format str5 %5s,
>> b is format str13  %13s) I want to convert these string variables to numeric
>> variables.
>>
>> I use: gen a_n = real(a)
>>
>> Stata generates new values for a_n. But using the browser I see that
>> variable a_n doesn't have any values. What's wrong?
>>
>> Thanks,
>> Fabian
>>
>> --
>> Psssst! Schon vom neuen GMX MultiMessenger geh�rt? Der kann`s mit allen:
>> http://www.gmx.net/de/go/multimessenger
>> *
>> *   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/
>>
>
>
> *
> *   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/
>

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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index