Transforming 2 variables into 1

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

estroe
Posts: 3
Joined: Tue Apr 29, 2014 9:08 am

Transforming 2 variables into 1

Postby estroe » Tue Apr 29, 2014 9:14 am

Hi everyone,

I am currently writing my thesis. For this, I have held a survey on different schools.
I have 2 variables I want to combine into one new variable.

The 2 questions are:

Which school do you go to? (A)
Which study do you do? (B)

The first has 2 answers and the second 5. I want to combine these 2 so it will end up with like this:

Answer A1+B1 = 0
Answer A1+B2 = 1
Answer A1+B3 = 2
...
Answer A2+B1 = 5
Answer A2+B2 = 6
etc.

How would I go about doing this? I've been searching on the internet but I was unable to find out how.

This would really help me to find out the results properly.
I hope you guys can help me!

Thanks in advance,

Richard
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Transforming 2 variables into 1

Postby GerineL » Tue Apr 29, 2014 12:05 pm

you can do this via if-functions :

if (varnameA =1 & varnambeB = 1) newvariablename = 0.
if (varnameA =1 & varnambeB = 2) newvariablename = 1.
(etc)
execute.




use
= "1"
instead of
1
if it is a string variable
estroe
Posts: 3
Joined: Tue Apr 29, 2014 9:08 am

Re: Transforming 2 variables into 1

Postby estroe » Tue Apr 29, 2014 12:54 pm

Thanks for the help!

Where would I input such a line? I've never used something like that before.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: Transforming 2 variables into 1

Postby GerineL » Tue Apr 29, 2014 2:45 pm

in syntax window, new -> syntax
estroe
Posts: 3
Joined: Tue Apr 29, 2014 9:08 am

Re: Transforming 2 variables into 1

Postby estroe » Wed Apr 30, 2014 10:24 am

Ah, I found it, thanks!

It took me a while but I got it to work! Thanks a bunch!

Who is online

Users browsing this forum: No registered users and 1 guest

cron