Combine 2 dichotomous variables into 1 categorical

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Combine 2 dichotomous variables into 1 categorical

Gerónimo Maldonado

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!
--

Reply | Threaded
Open this post in threaded view
|

Re: Combine 2 dichotomous variables into 1 categorical

Marinica Barbulescu - Yahoo
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!
--


Reply | Threaded
Open this post in threaded view
|

RE: Combine 2 dichotomous variables into 1 categorical

MaxJasper
In reply to this post by Gerónimo Maldonado
Message
First decide to address the conflict of {(HIV=1) AND (AIDS=1)}?

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!
--

 
Reply | Threaded
Open this post in threaded view
|

Re: Combine 2 dichotomous variables into 1 categorical

John F Hall
Message

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

www.surveyreearch.weebly.com

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of MaxJasper
Sent: 04 February 2011 19:25
To: [hidden email]
Subject: Re: Combine 2 dichotomous variables into 1 categorical

 

First decide to address the conflict of {(HIV=1) AND (AIDS=1)}?


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!
--

 

 


View this message in context: RE: Combine 2 dichotomous variables into 1 categorical
Sent from the SPSSX Discussion mailing list archive at Nabble.com.