Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Anna Reimondos <areimondos@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Identifying subfamilies (2nd+ marriages) within records of families |
Date | Thu, 2 Feb 2012 09:53:50 +1100 |
Hi, I have a dataset of families which looks something like this: The first variable is a family id, then there is a registration number, and a variable identifying whether the person is the wife, husband or child. In the example below there are two families. In the first family there is a wife, husband and kids. In the second family the woman has had 2 marriages. In the first she had 2 children, and in the second marriage she had one child. What I would like to do is create a variable called 'familynum' which will number the different families within the main family. NB: There is no registration or familynum for the woman. family reg person familynum 1 Wife (1) 1 693 Husband(2) 1 1 693 Child (3) 1 1 693 Child (3) 1 2 Wife (1) 2 542 Husband(2) 1 2 542 Child (3) 1 2 542 Child (3) 1 2 879 Husband(2) 2 2 879 Child (3) 2 I have done similar things before, and I know the solution is probably very obvious...but I am having a blonde moment. Thanks Anna * * 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/