Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Creating new variables for parent groups in a joint family |
Date | Tue, 28 Aug 2012 16:53:25 +0100 |
You can calculate new variables such as egen edu3 = total((relationcode == 3) * education) , by(HHID) egem edu4 = total((relationcode == 4) * education), by(HHID) and then collapse edu3 edu4 , by(HHID) For "STATA" read "Stata". Nick On Tue, Aug 28, 2012 at 4:42 PM, Tanu Kohli <tkohli@andromeda.rutgers.edu> wrote: > I have a dataset that contains information on joint families and is coded and > arranged in the following way- > > HHID Relation to the Head Relation code Education > 1 Self 1 3 > 1 Spouse of head 2 1 > 1 Married Child 1 3 10 > 1 Spouse of married child 1 4 7 > 1 Grandchild 1 6 3 > 1 Grandchild 2 6 2 > 1 Married child 2 3 12 > 1 Spouse of married child 2 4 13 > 1 Grandchild 3 6 1 > > I want to seperate education of married child 1 and spouse of married child 1 as > new variables corresponding with their children's education (grandchild 1 and > grandchild 2). Similarly, I want new variables for education of married child 2 and > his spouse corresponding with their child (grandchild 3). > > How can I do this STATA so that I have only 1 observation for household 1 and rest > information as new variables? > * * 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/