## Reconvert a variable

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

StaticGuy
Posts: 4
Joined: Tue Jan 09, 2018 11:03 am

### Reconvert a variable

Hi everyone, I am new to this forum, this is my first message and i'm not sure if this is the best subforum for ask it.

I have a trouble reconverting a variable, i'm going to expose my case:

-Imagine that I have 3 variable (VAR1, VAR2, VAR3) with 3 lables eachone (1,2,3) and i want to create an auxiliar variable (AUX) that

if VAR1 is 1 then AUX= 1
if VAR1 is 2 then AUX= 2
if VAR1 is 3 then AUX= 3
if VAR2 is 1 then AUX= 4
if VAR2 is 2 then AUX= 5
if VAR2 is 3 then AUX= 6
if VAR3 is 1 then AUX= 7
if VAR3 IS 2 then AUX= 8
if VAR3 is 3 then AUX= 9

I could do 9 "if" but the problem is that I have 90 variables with different number of labels each one, how can i create this auxiliar variable with SPSS syntax?

Thank you for the help mates!
statman
Posts: 2760
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

### Re: Reconvert a variable

Look into the RECODE function

Also, ...............
See the note below

Statman
Statistical Services
StaticGuy
Posts: 4
Joined: Tue Jan 09, 2018 11:03 am

### Re: Reconvert a variable

Thank you so much for the help, i used the RECODE function and it worked . I have a little issue, the variable change with the recode function but values didn't change. Do you know any function for change the numbers of variable and the numbers of values?
I'm working on VERSION 23, my OS is Windows 10 and i can't show the data.
statman
Posts: 2760
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

### Re: Reconvert a variable

Which variable value didn't change, AUX?
StaticGuy
Posts: 4
Joined: Tue Jan 09, 2018 11:03 am

### Re: Reconvert a variable

Yes, the variable AUX have the correct numbers but it lost the values
statman
Posts: 2760
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

### Re: Reconvert a variable

Unclear, are you now saying that AUX isn't saved or what happens to the value
See the note below

Statman
Statistical Services
StaticGuy
Posts: 4
Joined: Tue Jan 09, 2018 11:03 am

### Re: Reconvert a variable

The variable AUX have the correct numbers but haven't got value tags (in SPSS is called "values") of the originals variables. I don't know if this is the best terminology for explain the problem that i had but it is the terminology that use SPSS. Anyway i solved it with a tons of code thanks to "Recode" function that you gave me. Thank you so much for the help (:

### Who is online

Users browsing this forum: No registered users and 2 guests