indexing - How to recreate Excel's "Index(,,Match())" function in SPSS? -
i trying recreate excel's "index(,,match())" function in spss. data organized follows:
the "position" variables indicate column (t:v) value in "value" variables should go.
in 1st row, positions in order 1-3, values in columns t:v in same order "value" variables.
in second row positions 2,3,1; value in "value1" should go in column u (the second column in last block of variables), value in "value2" should go in column v, , value in "value 3 should go in column t. , on.
after looking doing in spss, spss' index , match functions not help.
do excel/spss users know how accomplish in spss syntax?
there several ways approach problem, depending on how many columns you're dealing , whether they're numeric or if there strings (there's matrix algebra answer, can't think of it).
if have 3 sets of 3 columns, simplest approach write 9 (3*3) if-statements (you don't have column names cols t/u/v, i'm referencing excel column):
if (position1 = 1) t = value1. if (position1 = 2) t = value2. if (position1 = 3) t = value3. if (position2 = 1) u = value1. if (position2 = 2) u = value2. ...
this should work. if have many more columns, can use vector loops define sets of variables.
Comments
Post a Comment