Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Robert De Vries <robert.devries@sociology.ox.ac.uk> |
To | "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |
Subject | st: matching cases by a transitive relation |
Date | Fri, 11 Jan 2013 12:03:29 +0000 |
Dear Statalisters, I have a problem with attempting to match cases by a transitive relation (A is related to B, B is related to C, so C must be related to A). Specifically, I am working with the longitudinal British Household Panel Study (BHPS), and I am attempting to match siblings across time. I can straightforwardly create a dataset which includes the ID number of all sibling pairs in the dataset in the following format: ID | SIBLING ID A | B B | A B | C However, this dataset does not reflect the additional relationship A-C. This occurs when A and C are siblings but have never actually lived together. For example, in Wave 1, A and B are siblings living together. By Wave 2, A has moved out, and B has gained a new sibling; C (this might be a step-sibling, for example, or a new birth). My dataset reflects that fact that A and B are siblings, and that B and C are siblings, but because A and C have never been coded as siblings, my dataset does not reflect that they are. By their transitive relation through B, we know that A and C are siblings. My question is: what code could I write to get the dataset to reflect this? I need to somehow tell Stata that if A is related to B AND B is related to C, you need to create a new case which reflects that A is related to C. Hope you can help! Robert de Vries * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/