Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Creating new variables for parent groups in a joint family


From   Nick Cox <[email protected]>
To   [email protected]
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
<[email protected]> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index