Hi, It's my first time using stata and I wanted to know how creating binary variables is possible. I've looked through the help command, Stata forum, and online PDF instructions.
So I am trying to create binary variables for region continent and for sex from categorical variables/ stream variables.
I keep getting back r 109; for a type mismatch with the following code:
generate Sex_numerical = 0
replace Sex_numerical = 1 Sex == "Female"
replace Sex_numerical = . if Sex == .
destring Sex_numerical, replace force
Noting Sex is the variable already in the dataset.
For the continent dummy, I want to do similar where 0 = not in continent 1= in continent for Oceania, Asia, North America, South America, Africa, and Europe.
Using Country_Code variable to generate these.
I'm sorry this is probably a simple question but thanks for any help you can provide.
So I am trying to create binary variables for region continent and for sex from categorical variables/ stream variables.
I keep getting back r 109; for a type mismatch with the following code:
generate Sex_numerical = 0
replace Sex_numerical = 1 Sex == "Female"
replace Sex_numerical = . if Sex == .
destring Sex_numerical, replace force
Noting Sex is the variable already in the dataset.
For the continent dummy, I want to do similar where 0 = not in continent 1= in continent for Oceania, Asia, North America, South America, Africa, and Europe.
Using Country_Code variable to generate these.
I'm sorry this is probably a simple question but thanks for any help you can provide.
Comment