recoding a variable with conditions on other variables in other entries...

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

sara_ek
Posts: 1
Joined: Wed Mar 01, 2017 7:54 pm

recoding a variable with conditions on other variables in other entries...

Postby sara_ek » Wed Mar 01, 2017 8:32 pm

Hi,

I am stuck with a variable recoding in a 200 000 entries database, so please help!

Here's an example of what i'd like to do:

Consider these 3 variables X, Y and Z

X Y Z
1 1 1
1 1 2
1 2 2
2 1 5
2 1 1
2 1 2
2 2 2
2 3 5


IF Y=1 THEN look the other entries having the same X value
Among these IF you find one entry with Y different than 1, keep in memory its Y value THEN DO THE FOLLOWING
for all the entries having the same X value and the same Z value RECODE Y into the Y value recorded
look for the other entries with Y different than 1 (The possible values of Y are {1, 2 or 3})

So that on the given example the result would be the following:

X Y Z

1 1 1
1 2 2
1 2 2

2 3 5
2 1 1
2 2 2
2 2 2
2 3 5

Is there a way to do this in SPSS??
I would really appreciate the help... otherwise it is going to be days in cleaning the database up!!

Many thanks in advance!
Sara
Yousiffeccr
Posts: 4
Joined: Wed Sep 20, 2017 1:40 am
Location: Bulgaria
Contact:

recoding a variable with conditions on other variables in other entries

Postby Yousiffeccr » Thu Oct 12, 2017 10:50 am

The way that Krambriw said, is not the only one.
There is also another way to get or set the plugin variables.
You can see it in the following example:Test_variable_access.png 18.59 KiB Viewed 3284 times

Who is online

Users browsing this forum: No registered users and 2 guests

cron