Hi, I am trying to create a new variable and then replace the values with the values of another variable given that that observation meets specific specifications. However, I am getting a type mismatch.
gen femedc = .
replace femedc = hv106_05 if hv101_05 == "Co-spouse" | hv101_05 == "Wife or husband" | hv101_05 == "co-spous" | hv101_05 == "wife or"
femedc is my new variable. hv106_05 is the education of the fifth member in a household on a categorical scale. hv101_05 is the relationship of the house member to the household head. I want to replace femedc with the value of hv106_05 if that house member is the spouse of the household head. Does anyone know how to solve this problem?
Thank you in advance!
Andrew Hargrove
gen femedc = .
replace femedc = hv106_05 if hv101_05 == "Co-spouse" | hv101_05 == "Wife or husband" | hv101_05 == "co-spous" | hv101_05 == "wife or"
femedc is my new variable. hv106_05 is the education of the fifth member in a household on a categorical scale. hv101_05 is the relationship of the house member to the household head. I want to replace femedc with the value of hv106_05 if that house member is the spouse of the household head. Does anyone know how to solve this problem?
Thank you in advance!
Andrew Hargrove
Comment