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

Postby StaticGuy » Tue Jan 09, 2018 11:22 am

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
Administrator
Posts: 2750
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: Reconvert a variable

Postby statman » Tue Jan 09, 2018 2:29 pm

Look into the RECODE function

Also, ...............
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
StaticGuy
Posts: 4
Joined: Tue Jan 09, 2018 11:03 am

Re: Reconvert a variable

Postby StaticGuy » Wed Jan 10, 2018 12:18 pm

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
Administrator
Posts: 2750
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: Reconvert a variable

Postby statman » Wed Jan 10, 2018 12:55 pm

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

Re: Reconvert a variable

Postby StaticGuy » Wed Jan 10, 2018 2:02 pm

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

Re: Reconvert a variable

Postby statman » Wed Jan 10, 2018 4:42 pm

Unclear, are you now saying that AUX isn't saved or what happens to the value
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
StaticGuy
Posts: 4
Joined: Tue Jan 09, 2018 11:03 am

Re: Reconvert a variable

Postby StaticGuy » Thu Jan 11, 2018 12:45 pm

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 4 guests

cron