The "dataset" is below in the table. Every year you see a different set of persons (either 2 or 3) living at the same physical address. You want to create a unique identifier (ID2 below) that says they are all related--maybe they are all biologically related children. However, right now you can only create ID1 (e.g., using egen group). How would you create ID2?
Here is an example using the names in the table below. In 2000, Mary and Todd live together; let's say they have the same parents. We never see Mary live together with Rick, but we see Todd and Rick live together in 2010. Because we see Todd live with Mary in 2000, we want to conclude that Mary is also related to Rick, even though we never see Mary live with Rick. The same kind of reasoning applies for Carmen. We never see Carmen live with Rick, but we know Carmen lived with Todd, and Todd lived with Rick. Therefore, Carmen and Rick are also relatives. Ultimately we want to create ID2.
Here is an example using the names in the table below. In 2000, Mary and Todd live together; let's say they have the same parents. We never see Mary live together with Rick, but we see Todd and Rick live together in 2010. Because we see Todd live with Mary in 2000, we want to conclude that Mary is also related to Rick, even though we never see Mary live with Rick. The same kind of reasoning applies for Carmen. We never see Carmen live with Rick, but we know Carmen lived with Todd, and Todd lived with Rick. Therefore, Carmen and Rick are also relatives. Ultimately we want to create ID2.
| year | person 1 | person 2 | person 3 | ID1 | ID2 |
| 2000 | Mary | Todd | Carmen | 1 | 1 |
| 2005 | Todd | Carmen | 2 | 1 | |
| 2010 | Rick | Todd | 3 | 1 |

Comment