Statalist


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

RE: st: RE: string to numeric(non-numeric)


From   Gauri Khanna <gwkhanna@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: string to numeric(non-numeric)
Date   Mon, 7 Apr 2008 10:55:50 +0000

Thanks Martin. Yes it worked. 

Gauri 

> Date: Mon, 7 Apr 2008 11:49:26 +0100
> From: maartenbuis@yahoo.co.uk
> Subject: st: RE: string to numeric(non-numeric)
> To: statalist@hsphsun2.harvard.edu
>
> The problem is the comma, so you should type:
> destring malespop, gen(MalesNum) ignore(",")
>
> Hope this helps,
> Maarten
>
> --- Gauri Khanna wrote
>> I am trying to convert a string variable(malespop) to a numeric
>> variable. I tried to the following:
>>
>> -destring malespop, generate(MalesNum)-
>> -destring malespop, replace
>> -destring males, gen(MalesNum) ignore(" ")
>>
>> but with each of these I got the following error:
>>
>> - malespop contains non-numeric characters; no generate-
>>
>> I tried to use -mvencode- but that did not work too. I tried -gen
>> MalesNum=real(malespop) but got missing values for all entries!
>>
>> My data looks like this and has blanks in between for no values:
>>
>> SNo. malespop
>>
>> 1. 45,623
>> 2.
>> 3. 67,345,119
>> 4.
>> 5.
>> 6. 3406
>> 7. 56,670,986
>> 8.
>
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room Z434
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
> ___________________________________________________________
> Yahoo! For Good helps you make a difference
>
> http://uk.promotions.yahoo.com/forgood/
> *
> * 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/

_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
*
*   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