I have 4 variables from which I want to create a new variable.
v1 = do you live with mom? (0, 1)
v2 = do you live with dad?
v3 = do you live with stepmother?
v4 = do you live with stepfather?
I want to create a variable PCOMP and code
1 if live with mom and dad
2 if live with mom and stepfather
3 if live with stepmother and dad
4 if live with mom only
5 if live with dad only
6 Other
I'd also like to identify who is from a two-parent household.
How do I do this?
There are many ways this could be handled, here is the one I suggested:
pcomp = v1 + 10*v2 + 100*v3 + 1000*v4
recode pcomp 11=1 1001=2 110=3 1=4 10=5 else=6
two_parent = pcomp < 4
Note: This is in pseudo-code and can be adapted to any stat package that supports recode. Also, the client will have to decide how to deal with missing values as this approach will not work with missing values for v1-v4.
pbe