Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Quang Nguyen <quangdata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Re: Linking information from other family members |
Date | Thu, 10 Feb 2011 07:07:34 +0700 |
Thanks Frederic for making the point that the example was not so clear in the last email. I just did some reformatting with the data. The original data looks like as follows: Family_id Relationship Migration Year_of_birth Year_migration 1 1 1 1965 1998 1 2 1 1980 2001 1 3 1 1985 2008 1 4 0 1995 1 5 0 2000 So relationship is the individual's relationship with household head: 1. is the head, 2 is wife, 4 is child and so on. We now would like to generate new variables to assign the years of migration that have ever taken place among family members to the the persons whose "relationship" are 4 and 5 respectively. Since there are 3 migrants in the family, there will be 3 new variables Y1, Y2, and Y3 whose values are the following: Family_id Relationship Y1 Y2 Y3 1 1 1 2 1 3 1 4 1998 2001 2008 1 5 1998 2001 2008 How can we generate variables Y1, Y2 , Y3 as above? * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/