Creating new variable from two variables

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

seandb
Posts: 2
Joined: Wed Jan 04, 2012 10:10 pm

Creating new variable from two variables

Postby seandb » Wed Jan 04, 2012 10:20 pm

Hello, I could use some help creating a new variable from 2 variables.

Example:
Variable #1 has 2 categories (1=yes, 2=no)
Variable #2 has 2 categories (1=yes, 2=no)
New Variable (1=yes, 2=no)

What I need to do is combine them. BUT what matters is whether or not they chose yes at all. So I don't need them added together. But I need to know whether "yes" was chosen.

E.G.
So if Variable #1 was yes, and Variable #2 was yes, then the new variable would simply be yes and only count "yes" once.

I hope that makes sense.

Thanks a lot for the help,
Sean
Stelios
Posts: 2
Joined: Fri Oct 16, 2009 7:45 am

Re: Creating new variable from two variables

Postby Stelios » Thu Jan 05, 2012 8:20 am

Hello,

This simple syntax will do the job!

IF (VARIABLE1=1 & VARIABLE2=1) VARIABLE3=1.
EXE.
seandb
Posts: 2
Joined: Wed Jan 04, 2012 10:10 pm

Re: Creating new variable from two variables

Postby seandb » Thu Jan 05, 2012 5:48 pm

Hi Stelios,

Thanks for taking the time to write a reply. Unfortunately I don't think this syntax is what I'm looking for. My post probably wasn't very clear. I don't want to sum those who said yes & yes. But count how many said yes at least once. It doesn't matter to me whether or not they said yes to both questions, but whether they replied yes once, to at least one of the two questions.

e.g.
participant 1's reponse
question 1: yes
question 2: no
participant 2's reponse
question 1: yes
question 2: yes
participant 3's reponse
question 1: no
question 2: no

For new variable I would thus have: 2 yes (participant #1 & #2) and 1 no (participant #3).

Cheers,
Sean

Who is online

Users browsing this forum: No registered users and 2 guests

cron