Statalist


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

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


From   Gauri Khanna <[email protected]>
To   <[email protected]>
Subject   st: RE: string to numeric(non-numeric)
Date   Mon, 7 Apr 2008 10:39:44 +0000

**Sorry for cross posting - having trouble with messages to Statalist.**

Dear Stata list,

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.

I am trying to create a column total of malespop using -egen total- command and for more calculation.

Grateful for your advice.

Gauri Khanna



_________________________________________________________________
Connect to the next generation of MSN Messenger�
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
*
*   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