I have matched data, i.e. data that matches individual in column 1 to individuals in column 2. As such, these can be viewed as a bipartite graph. I only wish to keep those individuals that exist in both columns. An example data set is :
I want to delete observations that don't appear in both columns. In this case, 2 only appears in column 2- thus I want to delete those all those observations where 2 appears. Any help is appreciated.
Code:
clear column1 column2) 1 2 1 3 1 4 4 1 4 2 4 3 3 1 end