Reputation: 21
I have data from an go/no go experiment with 200 variables.
I would like to recode the reactiontime into new variables GoTrialRT1 to 100 (if the trial is 1 to 15) and NoGoTrialRT1 to 100 if the trial is 0. Is it a way to do this with spss syntax or in r?
ID | trial1 | trial2 | trial3 | trial.. | answer1 | answer2 | answer3 | answer.. |
---|---|---|---|---|---|---|---|---|
1 | 3 | 5 | 14 | .. | 489 | 363 | 700 | .. |
2 | 0 | 6 | 15 | .. | 368 | 967 | 1201 | .. |
3 | 8 | 0 | 10 | .. | -1 | 671 | 890 | .. |
4 | 2 | 7 | 0 | .. | 358 | 353 | -1 | .. |
Upvotes: 0
Views: 116
Reputation: 11310
The following code will put the value of answerX
in NoGoTrialRTX
if the trialX
value was 0 or in GoTrialRTX
if the trialX
value was larger than 0 (leaving the other one empty). If trialX
was missing both NoGoTrialRTX
and GoTrialRTX
will remain empty:
do repeat trl = trial1 to trial100
/ans = answer1 to answer100
/Ng = NoGoTrialRT1 to NoGoTrialRT100
/Yg = GoTrialRT1 to GoTrialRT100.
if trl = 0 Ng=ans.
if trl > 0 Yg=ans.
end repeat.
Upvotes: 1