Hi everyone,
In my data set, I have data from an experiment (long reshaped) that was played for 15 rounds and 2 different treatments. This means I have 30 different variables (one for each round x one per treatment) where I know if the player was a player 1 or 2. Because I want to graph something filtering only for player 1 in each round, I want to create a variable that tells me when the player was P1.
I've tried with this:
However, because I had 15 rounds sooner or later, all players had the role of player 1, and therefore, the variable always took value 1 for everyone.
The data are like this:
In my code, Player 1 is a player when
while Player 2 and 4 are player 2.
Thank you for any help you can give me
In my data set, I have data from an experiment (long reshaped) that was played for 15 rounds and 2 different treatments. This means I have 30 different variables (one for each round x one per treatment) where I know if the player was a player 1 or 2. Because I want to graph something filtering only for player 1 in each round, I want to create a variable that tells me when the player was P1.
I've tried with this:
Code:
gen P1_round = 0 foreach i of numlist 1/15 { replace P1_round = 1 if inlist(hd`i'groupid_in_subsession, 1, 3) | inlist(sh`i'groupid_in_subsession, 1, 3) }
The data are like this:
Code:
hd1groupid_in_subsession hd2groupid_in_subsession hd3groupid_in_subsession hd4groupid_in_subsession hd5groupid_in_subsession... 3 1 4 3 3 2 3 2 4 2 1 2 4 2 2 4 4 2 4 3 1 4 1 1 2 1 3 4 1 1 4 2 1 2 4 3 1 4 3 4 2 1 3 3 3 ...
Code:
hd#groupid_in_subsession== 1 and 3 | sh#groupid_in_subsession== 1 and 3
Thank you for any help you can give me