*SPSS syntax example by www.spss-tutorials.com.

*SPSS - FIND VARIABLE HOLDING MAX VALUE WITHIN CASES.

*Create some empty cases.

data list free/id.
begin data
1 2 3 4 5
end data.

*Create scores.

set seed 1.
do repeat #new = A B C D E F G H I J.
compute #new = rv.normal(0,1).
end repeat.
execute.

*Make columns narrow.

variable width all (5).

*Solution start here but does not handle ties properly.

do repeat #max = A to J / #cnt = 1 to 10.
if (#max = max(A to J)) cat = #cnt.
end repeat.
execute.

*Add value labels to newly created variable.

value labels cat 1 "A" 2 "B" 3 "C" 4 "D" 5 "E" 6 "F" 7 "G" 8 "H" 9 "I" 10 "J".