Hi everyone,
Please find below data from a survey that asks participants to complete tasks A, B, C, D, E, F, G, H and I. The order in which these tasks were displayed to the participants was random.
1) The variable "uid" refers to participant id.
2) Variable "order" shows the order in which the tasks were displayed. For example, for participant 12216214, the 7th task was "A", whereas for participant 12216185 the 3rd task was "A"
Is there a way I can create a numeric variable (say "task_number") that captures the order number of the task for each individual and task.
For example, for scenario A, I want the variable to look like the following, see table below:
Any help on this will be highly appreciated.
Please find below data from a survey that asks participants to complete tasks A, B, C, D, E, F, G, H and I. The order in which these tasks were displayed to the participants was random.
1) The variable "uid" refers to participant id.
2) Variable "order" shows the order in which the tasks were displayed. For example, for participant 12216214, the 7th task was "A", whereas for participant 12216185 the 3rd task was "A"
Is there a way I can create a numeric variable (say "task_number") that captures the order number of the task for each individual and task.
For example, for scenario A, I want the variable to look like the following, see table below:
uid | order | task | task_number |
12216214 | DECFBGAHI | A | 7 |
12216185 | BCADIEHFG | A | 3 |
12216186 | ABICHDGEF | A | 1 |
12216247 | EFDGCHBIA | A | 9 |
12216232 | FGEHDICAB | A | 8 |
Code:
Code:* Example generated by -dataex-. For more info, type help dataex clear input long uid str9 order str1 task 12216214 "DECFBGAHI" "A" 12216185 "BCADIEHFG" "A" 12216186 "ABICHDGEF" "A" 12216247 "EFDGCHBIA" "A" 12216232 "FGEHDICAB" "A" 12216214 "GHFIEADBC" "B" 12216185 "BCADIEHFG" "B" 12216186 "DECFBGAHI" "B" 12216247 "HIGAFBECD" "B" 12216232 "CDBEAFIGH" "B" 12216214 "CDBEAFIGH" "C" 12216185 "EFDGCHBIA" "C" 12216186 "FGEHDICAB" "C" 12216247 "GHFIEADBC" "C" 12216232 "HIGAFBECD" "C" 12216214 "BCADIEHFG" "D" 12216185 "IAHBGCFDE" "D" 12216186 "CDBEAFIGH" "D" 12216247 "DECFBGAHI" "D" 12216214 "ABICHDGEF" "D" 12216185 "FGEHDICAB" "E" 12216186 "GHFIEADBC" "E" 12216247 "HIGAFBECD" "E" 12216232 "IAHBGCFDE" "E" . "" "" end
Comment