I have a dataset with ID numbers for respondents' friends and bullies.
I'd like to go through all the friendship nominations and all the bully nominations in each row and get a count of the number of people they nominate as both. Any help would be great!
HAVE DATA:
ID friend_1 friend_2 friend_3 bully_1 bully_2
1 4 12 7 12 15
2 8 6 7 18 20
3 9 18 1 2 1
4 15 7 2 7 13
5 1 17 9 17 1
6 9 19 20 14 12
7 19 12 20 9 12
8 7 1 16 2 15
9 1 10 12 1 7
10 7 11 9 11 7
WANT DATA:
ID friend_1 friend_2 friend_3 bully_1 bully_2 num_both
1 4 12 7 12 15 1
2 8 6 7 18 20 0
3 9 18 1 2 1 1
4 15 7 2 7 13 1
5 1 17 9 17 1 2
6 9 19 20 14 12 0
7 19 12 20 9 12 1
8 7 1 16 2 15 0
9 1 10 12 1 7 1
10 7 11 9 11 7 2