Select two variables with values closest to 50 among 5 variables

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

tastea
Posts: 1
Joined: Wed Mar 01, 2017 2:27 pm

Select two variables with values closest to 50 among 5 variables

I have a problem regarding the analysis of a big dataset, that I can't seem to tackle by myself! Help would be really appreciated:
This is the situation: I did an experiment in which participants had to evaluate the taste of 5 samples with different flavours. They would drink them out of small cups with blinded codes on them, and all would have a randomized drinking order of the 5 samples.

User = participant number
Loopvalue code 1, 2, 3, 4 and 5= 5 blinding codes that were used for the 5 samples that were given in random order to the participants.
Q15.1, Q15.2, Q15.3,. Q15.4 and Q15.5 = values between 0 and 100 that give information about the experienced pleasantness of each sample.

**Based on the Q15 scores I would like to select the two values (out of five) for each participant that are closest to 50.** I would like to make new variables for these values:

Example for user t10:
Middle_low = 50.6
Middle_high = 50.9

I don't know how to select the two values closest to 50 using spss. Doing it manually would take way too much time (I would have to select thousands of numbers).

Anyone have a suggestion?

Another question is how to link the blinding code to the matching Q15 question? Example:

Middle_low = 50.6
Middle_high = 50.9
Middle_low_nr = 390
Middle_high_nr = 159