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

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

From   Gauri Khanna <>
To   <>
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
3. 67,345,119
6. 3406
7. 56,670,986

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
*   For searches and help try:

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