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

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

 From "Tanu Kohli" To statalist@hsphsun2.harvard.edu Subject Re: st: Creating new variables for parent groups in a joint family Date Tue, 28 Aug 2012 12:42:21 -0400

```Thank you Nick. However, one household can have more than one set of parents in the
second generation. These are also coded as 3 and 4. i have education for 1st set of
parents coded as 3 and 4, but cannot get it for families which have more than one
couple in the second generation.

Any suggestions?

Sincerely,
Tanu Kohli
Division of Global Affairs/ Dept of Economics
Rutgers University
Newark

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)

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/

*
*   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/
```