I currently have the following data:
* Example generated by -dataex-. For more info, type help dataex
clear
input float(id BlockOrder1 BlockOrder2 BlockOrder3 BlockOrder4 BlockOrder5 Keuze1 Keuze2 Keuze3 Keuze4 Keuze5)
1 2 3 15 9 4 1 2 2 2 1
2 14 1 2 6 9 1 2 2 1 2
3 15 16 4 1 14 1 2 2 1 2
4 11 10 9 16 6 1 1 2 1 2
5 14 7 13 2 12 2 2 1 2 1
end
The data is of discrete choice type, with BlockOrder indicating which choice task number was randomly assigned to respondent i and Keuze the final choice (either 1 or 2) of respondent i. In the example I added 5 order/choice variables but the full dataset has 16.
For each respondent id or row, I want to generate y1-16, indicating which choice (i.e. Keuze*) was made but sorted according to the randomized order of choice tasks each respondent was presented with.
For example, Keuze1 for respondent 1 now returns the choice made in choice task 2, since respondent 1 was first presented with this one (then choice task 3, 15, 9, 4 etc. until the 16 were finished). Choice task 1 was presented 6th, i.e. at Keuze6. Y1 needs to indicate choice task 1, y2 choice task 2 etc.
Any suggestions on how to do this? Thank you in advance.
* Example generated by -dataex-. For more info, type help dataex
clear
input float(id BlockOrder1 BlockOrder2 BlockOrder3 BlockOrder4 BlockOrder5 Keuze1 Keuze2 Keuze3 Keuze4 Keuze5)
1 2 3 15 9 4 1 2 2 2 1
2 14 1 2 6 9 1 2 2 1 2
3 15 16 4 1 14 1 2 2 1 2
4 11 10 9 16 6 1 1 2 1 2
5 14 7 13 2 12 2 2 1 2 1
end
The data is of discrete choice type, with BlockOrder indicating which choice task number was randomly assigned to respondent i and Keuze the final choice (either 1 or 2) of respondent i. In the example I added 5 order/choice variables but the full dataset has 16.
For each respondent id or row, I want to generate y1-16, indicating which choice (i.e. Keuze*) was made but sorted according to the randomized order of choice tasks each respondent was presented with.
For example, Keuze1 for respondent 1 now returns the choice made in choice task 2, since respondent 1 was first presented with this one (then choice task 3, 15, 9, 4 etc. until the 16 were finished). Choice task 1 was presented 6th, i.e. at Keuze6. Y1 needs to indicate choice task 1, y2 choice task 2 etc.
Any suggestions on how to do this? Thank you in advance.
Comment