Merge two variables into one

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

Merge two variables into one

Gerónimo Maldonado

Hello All:
 
I want to create one variable from two previous ones (dichotomous), the resulting variable must have the yes/no from the first and only the yes of the second one. Here's the variables:
 
(1) Alcohol use in the last 12 months (yes/no)
 
(2) Alcohol Abuse in the last 12 months (yes/no) - quantified into how many alcoholic beverages the subject consumed in a weekly basis.
 
I want to create a variable that contains the yes/no of Alcohol use in the last 12 months and ONLY the yes of Alcohol Abuse in the last 12 months.
 
The categories of the resulting variable must be like this:
 
Alcohol use in the last 12 months:
 
Yes
No
Abuse
 
Thanks in advance for all your contributions. 
 
Reply | Threaded
Open this post in threaded view
|

Re: Merge two variables into one

Bruce Weaver
Administrator
Gerónimo Maldonado wrote
Hello All:

I want to create one variable from two previous ones (dichotomous), the
resulting variable must have the *yes/no* from the first and only the
*yes*of the second one. Here's the variables:

(1) Alcohol use in the last 12 months (yes/no)

(2) Alcohol Abuse in the last 12 months (yes/no) - quantified into how many
alcoholic beverages the subject consumed in a weekly basis.

I want to create a variable that contains the yes/no of Alcohol use in the
last 12 months and *ONLY* the yes of Alcohol Abuse in the last 12 months.

The categories of the resulting variable must be like this:

*Alcohol use in the last 12 months:*
**
*Yes*
*No*
*Abuse*

Thanks in advance for all your contributions.
I don't understand your statement that you want a variable "that contains the yes/no of Alcohol use in the
last 12 months and *ONLY* the yes of Alcohol Abuse in the last 12 months".  What happens to the cases where there is a YES for use, but a NO for abuse?  

Assuming your codes are 1=Yes, 2=No, you could do this:

compute Combined = var1*10 + var2.

value labels Combined
 11 'Use, abuse'
 12 'Use, no abuse'
 21 'No use, abuse'
 22 'No use, no abuse'
.

Of course, there should be no cases with Combined = 21 (no use, abuse).  If there are such cases, it would suggest a data entry error or some other problem.  

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Merge two variables into one

Jerabek Jindrich
In reply to this post by Gerónimo Maldonado
Hi,

COMPUTE NewVar = AlcoholUse.
IF AlcoholUse = 0 NewVar = 2.
IF AlcoholAbuse=1 NewVar=3.

VAL LAB NewVar 1 "used" 2"not used" 3 "abuse".

Here Abuse rewrites usage, hope it is what you need.

regards
JIndra

> ------------ Původní zpráva ------------
> Od: Gerónimo Maldonado <[hidden email]>
> Předmět: Merge two variables into one
> Datum: 01.10.2010 15:00:44
> ----------------------------------------
> Hello All:
>
> I want to create one variable from two previous ones (dichotomous), the
> resulting variable must have the *yes/no* from the first and only the
> *yes*of the second one. Here's the variables:
>
> (1) Alcohol use in the last 12 months (yes/no)
>
> (2) Alcohol Abuse in the last 12 months (yes/no) - quantified into how many
> alcoholic beverages the subject consumed in a weekly basis.
>
> I want to create a variable that contains the yes/no of Alcohol use in the
> last 12 months and *ONLY* the yes of Alcohol Abuse in the last 12 months.
>
> The categories of the resulting variable must be like this:
>
> *Alcohol use in the last 12 months:*
> **
> *Yes*
> *No*
> *Abuse*
>
> Thanks in advance for all your contributions.
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD