Hello statalist community, I need your kind help in some code.
I want to subset this data set, so that I am left with the combinations of ("Unique ID Person", Unique ID Friend") without replacement. Which implies red rows are turned into missing values.
Or, so that I am left with the combinations ("Unique ID Person", Unique ID Friend")---> ( "A", "B") ( "C", ".") ( "D", ".") ( "E", "F") ( "G", ".") ( "H", "I") ( "J", ".")
Unique ID Person | Person's toffees | Unique ID Friend | Friend's toffees |
A | 2 | B | 5 |
B | 5 | A | 2 |
C | 9 | . | . |
D | 5 | . | . |
E | 7 | F | 17 |
F | 17 | E | 7 |
G | 11 | . | . |
H | 13 | I | 1 |
I | 1 | H | 13 |
J | 25 | . | . |
Or, so that I am left with the combinations ("Unique ID Person", Unique ID Friend")---> ( "A", "B") ( "C", ".") ( "D", ".") ( "E", "F") ( "G", ".") ( "H", "I") ( "J", ".")
Combinations of ("Unique ID Person", Unique ID Friend") | keep/don't keep |
( "A", "B") | keep |
("B", "A") | turn it in missing value |
( "C", ".") | keep |
( "D", ".") | keep |
( "E", "F") | keep |
("F", "E") | turn it in missing value |
( "G", ".") | keep |
( "H", "I") | keep |
("I", "H") | turn it in missing value |
( "J", ".") | keep |
Comment