Code: Select all

```
compute WU1=V14
IF (V15=1) WU1=2
IF (v16=1) WU1=3
IF (V17=1) WU1=4
IF (V18=1) WU1=5
IF (V19=1) WU1=6
IF (V20=1) WU1=7.
```

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

Ok, I know this has been covered, but I can't seem to make it work. I have some multiple choice data where each response was coded into a separate variable. I need to get them combined into one variable. Each response was coded as 1 or blank. I've tried the following syntax without success. WU1 is the "new" variable I need to create and V14-V20 are the existing variables... I think you can see what I was trying to do here.

Code: Select all

```
compute WU1=V14
IF (V15=1) WU1=2
IF (v16=1) WU1=3
IF (V17=1) WU1=4
IF (V18=1) WU1=5
IF (V19=1) WU1=6
IF (V20=1) WU1=7.
```

Nope but!

If you had 4 variables v1 to v4 that might be labeled as car1, car2, to car4 and if I have car1 & car3 then there is a '1' noted else blank the do your multiple response with dichotomies and count variable = 1

OK?

If you had 4 variables v1 to v4 that might be labeled as car1, car2, to car4 and if I have car1 & car3 then there is a '1' noted else blank the do your multiple response with dichotomies and count variable = 1

OK?

See the note below

**NOTE**: *Please read the Posting Guidelines and always tell us your OS, the SPSS version and information about your study and data!*

Statman

Statistical Services

Statman

Statistical Services

I have 4 variables lets call them V1-V4. They are the response options for one multiple choice question, so one person would only recieve a "1" for one of the 4 variables. The other three variables would be blank. What I'd like to be able to do is recode these 4 variables into 1 variable. The trick to it is if the person has a 1 for V1, I'd like it to appear in the new variable as a 1. But, if they have a 1 for V2 it would need to be recoded as a 2, V3 as a 3, V4 as a 4 and so on. I think I found a way around it by recoding the variables first, and then using the following syntax:

Code: Select all

`COMPUTE WU1=MAX(V1A, V1B, V1C, V1D).`

Users browsing this forum: No registered users and 2 guests