I am trying to filter rows based on a condition where two consequtive columns have a particular value. Say I have the following data consisting of an "id" and indicators if they appear in a series of interviews ("inw8-inw12"). I am trying to keep only those ids that have appeared in two consecutive interviews.
The sample data is as follows,
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long id byte(inw8 inw9 inw10 inw11 inw12)
1010 1 0 1 1 0
3020 0 0 0 0 0
3030 1 0 1 0 1
4010 1 1 0 0 0
4040 0 0 1 1 1
3010 1 0 0 0 1
3040 1 1 1 1 1
The result of my sample data:
Code:
1010 1 0 1 1 0
4010 1 1 0 0 0
4040 0 0 1 1 1
3040 1 1 1 1 1
0 Response to Keep rows if two consecutive columns have the same value
Post a Comment