Hello everybody, i have a question.
I've got a dataset with 3 nonnumeric string- variables. First i tried to convert the nonnumveric variables to numeric string variables and afterwards use the destring command... see here:
CODE:::
. **Preparing Dataset
.
. *2002
.
. *Missing Values
.
. use "E:\Stata\data\tAHS2002m.dta", clear
. keep smsa tenure nunit2 built cellar garage floors unitsf value weight
.
. replace garage="." if garage=="'-6'"|garage=="'-7'"|garage=="'-8'"|garage=="'-9'"
(11,411 real changes made)
.
.
. *Convert Nonnumeric String Variable to numeric string variable
.
. *Install
. ssc install egenmore
checking egenmore consistency and verifying not already installed...
all files already exist and are up to date.
. ssc install ereplace
checking ereplace consistency and verifying not already installed...
all files already exist and are up to date.
.
. *for Variable garage
. ereplace garage = sieve(garage), keep(numeric)
(11411 missing values generated)
(65,516 real changes made)
.
. *for Variable tenure
. *ereplace tenure = sieve(tenure), keep(numeric)
.
. *for Variable nunit2
. ereplace nunit2 = sieve(nunit2), keep(numeric)
(65,516 real changes made)
.
.
. *convert string variable to numeric variable
.
. destring garage, replace
garage has all characters numeric; replaced as byte
(11411 missing values generated)
. nunit2 has all characters numeric; replaced as byte
command nunit2 is unrecognized
r(199);
end of do-file
r(199);
.
As soon as i br the data, the variables are shown as byte variables, so why does an error occur?
Hope anybody can help me...
Many thanks
I've got a dataset with 3 nonnumeric string- variables. First i tried to convert the nonnumveric variables to numeric string variables and afterwards use the destring command... see here:
CODE:::
. **Preparing Dataset
.
. *2002
.
. *Missing Values
.
. use "E:\Stata\data\tAHS2002m.dta", clear
. keep smsa tenure nunit2 built cellar garage floors unitsf value weight
.
. replace garage="." if garage=="'-6'"|garage=="'-7'"|garage=="'-8'"|garage=="'-9'"
(11,411 real changes made)
.
.
. *Convert Nonnumeric String Variable to numeric string variable
.
. *Install
. ssc install egenmore
checking egenmore consistency and verifying not already installed...
all files already exist and are up to date.
. ssc install ereplace
checking ereplace consistency and verifying not already installed...
all files already exist and are up to date.
.
. *for Variable garage
. ereplace garage = sieve(garage), keep(numeric)
(11411 missing values generated)
(65,516 real changes made)
.
. *for Variable tenure
. *ereplace tenure = sieve(tenure), keep(numeric)
.
. *for Variable nunit2
. ereplace nunit2 = sieve(nunit2), keep(numeric)
(65,516 real changes made)
.
.
. *convert string variable to numeric variable
.
. destring garage, replace
garage has all characters numeric; replaced as byte
(11411 missing values generated)
. nunit2 has all characters numeric; replaced as byte
command nunit2 is unrecognized
r(199);
end of do-file
r(199);
.
As soon as i br the data, the variables are shown as byte variables, so why does an error occur?
Hope anybody can help me...
Many thanks
Comment