Hello,
I would like to ask if I could change variable categories' name.
I have this variable - Marital status with possible responses: 1="married-first and only marriage", 2="remarried-second or later marriage", 3="separated", 4="divorced", 5="widowed" and 6="have never married". I've already regrouped the first two (2=1) and the other ones into one single category. Then, I've created a dummy variable with 1=married and 0=single. But, I couldn't change the category's name. When I write: tab var or tab var, nol I can see that STATA automatically put the first two labels - 1="married-first and only marriage" and 2="remarried-second or later marriage" and it seems that I didn't create the dummy variable.
So my question is how to rename the first two categories and why I can't see the dummy variable created.
Please find herewith the code that I used to regroup and create a dummy variable. Also, I have tried to rename the categories, but it didn't work at all.
*Recode Marital status
tab e_mar_stat
tab e_mar_stat, nol
recode e_mar_stat (2 = 1)
recode e_mar_stat (6 = 3) (5 = 3) (4 = 3)
recode e_mar_stat (3 = 2)
tab e_mar_stat, nol
*Dummy for marital status
generate married=.
replace married=1 if e_mar_stat==1
generate single=.
replace single=0 if e_mar_stat==2
label variable e_mar_stat "Marital status"
label define mscats 1 "Maried" 2 "Single", modify
label values e_mar_stat mscats
Cheers,
Darina
I would like to ask if I could change variable categories' name.
I have this variable - Marital status with possible responses: 1="married-first and only marriage", 2="remarried-second or later marriage", 3="separated", 4="divorced", 5="widowed" and 6="have never married". I've already regrouped the first two (2=1) and the other ones into one single category. Then, I've created a dummy variable with 1=married and 0=single. But, I couldn't change the category's name. When I write: tab var or tab var, nol I can see that STATA automatically put the first two labels - 1="married-first and only marriage" and 2="remarried-second or later marriage" and it seems that I didn't create the dummy variable.
So my question is how to rename the first two categories and why I can't see the dummy variable created.
Please find herewith the code that I used to regroup and create a dummy variable. Also, I have tried to rename the categories, but it didn't work at all.
*Recode Marital status
tab e_mar_stat
tab e_mar_stat, nol
recode e_mar_stat (2 = 1)
recode e_mar_stat (6 = 3) (5 = 3) (4 = 3)
recode e_mar_stat (3 = 2)
tab e_mar_stat, nol
*Dummy for marital status
generate married=.
replace married=1 if e_mar_stat==1
generate single=.
replace single=0 if e_mar_stat==2
label variable e_mar_stat "Marital status"
label define mscats 1 "Maried" 2 "Single", modify
label values e_mar_stat mscats
Cheers,
Darina
Comment