|
Hello All, I will probaby pose an elemental question, but at this moment I'm completely bugged out. I want to combine 2 dichotomous variables into 1 categorical, as follows:
HIV (0=No / 1=Yes)
AIDS (0=No / 1=Yes) INTO:
newvar name=HIV_AIDS, where 1 is HIV & 2 is AIDS
Thanks in advance!
-- |
|
Hi Geronimo, I guess everybody was new at the beginning, so I don't mind paying attention to more junior questions. However, to successfully combine the 2 dichos into one categorical, you must take into consideration all the possible pairs of values. Assuming V1 and V2 are 2 dichotomic variables, the possibilities are: V1=0 & V2=0, V1=0 & V2=1, V1=1 & V2=0, V1=1 & V2=1. As you can see, there are 4 possible combinations, therefore you have to to accomodate all these into your new categorical variable (V3): if (V1=0 & V2=0) V3=1. if (V1=0 & V2=1)
V3=2. if (V1=1 & V2=0) V3=3. if (V1=1 & V2=1) V3=4. exec. This should work for any type of information that the variables might contain, not just HIV/AIDS. HTH, Marinica From: Gerónimo Maldonado <[hidden email]> To: [hidden email] Sent: Fri, February 4, 2011 7:34:05 PM Subject: Combine 2 dichotomous variables into 1 categorical Hello All, I will probaby pose an elemental question, but at this moment I'm completely bugged out. I want to combine 2 dichotomous variables into 1 categorical, as follows:
HIV (0=No / 1=Yes)
AIDS (0=No / 1=Yes) INTO:
newvar name=HIV_AIDS, where 1 is HIV & 2 is AIDS
Thanks in advance!
-- |
|
In reply to this post by Gerónimo Maldonado
First decide
to address the conflict of {(HIV=1) AND (AIDS=1)}?
|
|
Another way is to multiply one variable by 10, add it to the other one and then use RECODE COMPUTE HIV_AIDS = HIV*10 + AIDS. *Should produce four values, 0,1,10, 11 . recode hiv-aids (0=1) (10=2)(1=3)(11=4). val lab hiv_aids 1 ‘Neither’ 2 ‘Aids only’ 3 ‘HIV only’ 4 ‘Both’ . IF is an expensive procedure: COMPUTE with RECODE is quicker and cheaper. You still have a logical problem with your categories. John Hall From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of MaxJasper First decide to address the conflict of {(HIV=1) AND (AIDS=1)}?
View this message in context: RE: Combine 2 dichotomous variables into 1 categorical |
| Free forum by Nabble | Edit this page |
