Dear Statalist,

Imagin 3 players transmitting messages, we say a player transmits a message correctly if she copied the same message with her upstream player.
Now I have the data of all the copied messages and the sequence of players but I don't know how to create the new variable recording whether she copied the upstream message correctly.
i.e. whether the message she copied is the same as her upstream message.


Code:
    input id entry1 entry2 entry3
    1  123 456 789
    2  789 123 456
    3  456 789 123
    end
I want to generate a new variable say whether entry2 is copied correctly. If player2's entry 2 = player1's entry1, we say player2 copied correctly.
Something like the following (which is not working "invalid syntax"):

Code:
bysort id: gen correct2=1 if id==2 & entry2[2]==entry1[1]
Any help would be much appreciated!