Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to match children with their parents?

    Dear all,

    I have two sub-datasets of a household survey: one contains information on child labor (called hh data) and the other contains information of each household member (called hl data). I want to match child labor information in the hh data with their fathers and mothers in the hl data. In other words, I want to identify who are fathers and mothers of children in child labor section. Thank you.
    The hh data - observations are identified by hh1 hh2 cline
    Code:
    clear
    input double(hh1 hh2 cline cage)
    1  1 3 15
    1  2 4  2
    1  3 4 10
    1  4 4  6
    1  7 3 17
    1  9 4 16
    1 11 5  2
    1 14 5  1
    1 15 3  2
    1 18 5  5
    1 19 6  1
    1 20 4  6
    2  1 6  1
    2  4 4 13
    2  6 4  4
    2  7 6  2
    2 11 5 14
    2 12 4  1
    2 13 4 10
    2 14 4  4
    2 15 3 10
    2 16 6  4
    2 17 2 13
    3  1 7  3
    3  2 6 10
    3  3 5  8
    3  5 4 11
    3  6 6  4
    3  7 7  5
    3  8 5  2
    3  9 3  6
    3 10 5  9
    3 11 4  2
    3 12 6  4
    3 13 3 16
    3 14 6  1
    3 16 5 15
    3 18 2  4
    3 19 3 16
    3 20 3  8
    4  3 4 17
    4  5 4  2
    4  6 3 11
    4  9 4 13
    4 10 3  6
    4 14 2 14
    4 15 3 13
    4 16 4 13
    4 17 5  7
    4 19 3  6
    end
    label values cline SL9B
    The hl data - observations are identified by hh1 hh2 hl1
    Code:
    clear
    input int hh1 byte(hh2 hl1 gender mob) int yob byte(age mline fline edline ed3 ed4a ed4b)
    1  1 3 1 10 1998 15 2 1 3 1 3  0
    1  2 4 1  4 2011  2 2 3 4 . .  .
    1  2 5 1  5 2013  0 2 3 5 . .  .
    1  3 4 2  3 2003 10 2 3 4 1 1  4
    1  3 5 1  6 2007  6 2 3 5 1 1  0
    1  4 4 2 11 2007  6 2 1 4 1 1  0
    1  7 3 2 11 1996 17 2 1 3 1 3 11
    1  7 4 1  9 1998 15 2 1 4 1 3  0
    1  9 4 1  6 1997 16 2 3 4 1 3 10
    1  9 5 2  3 2002 11 2 3 5 1 2  0
    1 11 5 1  3 2011  2 4 3 5 . .  .
    1 14 5 2  3 2012  1 4 3 5 . .  .
    1 15 3 2  4 2011  2 2 1 3 . .  .
    1 18 5 1 10 2008  5 4 3 5 1 0  .
    1 19 6 2  6 2012  1 5 4 6 . .  .
    1 20 3 2 12 2005  8 2 1 3 1 1  2
    1 20 4 1  9 2007  6 2 1 4 1 1  0
    2  1 6 1 10 2012  1 5 4 6 . .  .
    2  4 4 1  7 2000 13 2 1 4 1 2  7
    2  6 4 1  5 2009  4 3 0 4 . .  .
    2  7 6 1  5 2011  2 . 3 6 . .  .
    2 11 5 2 10 1999 14 2 1 5 1 2  7
    2 12 4 1  9 2012  1 3 2 4 . .  .
    2 13 4 2  3 2003 10 1 2 4 1 1  4
    2 14 3 1  3 2002 11 1 2 3 1 2  0
    2 14 4 1  2 2009  4 1 2 4 . .  .
    2 15 3 1  8 2003 10 2 0 3 1 1  4
    2 15 4 1 12 2012  0 2 0 4 . .  .
    2 15 7 2  1 2012  1 6 5 7 . .  .
    2 16 6 1  5 2009  4 4 3 6 . .  .
    2 17 2 1  9 2000 13 0 0 2 1 2  7
    2 17 3 1 10 2001 12 0 0 3 1 2  6
    3  1 7 1 10 2010  3 6 5 7 . .  .
    3  2 5 2  5 1998 15 4 3 5 1 3  0
    3  2 6 2  4 2003 10 4 3 6 1 1  4
    3  3 5 2  1 2006  8 4 3 5 1 1  1
    3  3 6 2 10 2009  4 4 3 6 . .  .
    3  5 4 2  8 2002 11 2 1 4 1 2  0
    3  6 5 2  1 2001 13 4 3 5 1 2  6
    3  6 6 1  9 2009  4 4 3 6 . .  .
    3  7 5 1  3 2001 12 0 0 5 1 2  6
    3  7 6 1  8 2007  6 9 8 6 1 1  0
    3  7 7 2  5 2008  5 4 3 7 1 0  .
    3  8 4 2  2 2005  8 3 2 4 1 1  2
    3  8 5 1  8 2011  2 3 2 5 . .  .
    3 10 4 2 11 1998 15 3 1 4 1 3  0
    3 10 5 2  8 2004  9 3 1 5 1 1  3
    3 11 4 2  6 2011  2 3 0 4 . .  .
    3 12 5 1  9 2004  9 4 3 5 1 1  3
    3 12 6 1  4 2009  4 4 3 6 . .  .
    end
    label values gender hl4
    label def hl4 1 "male", modify
    label def hl4 2 "female", modify
    label values mob hl5m
    label values yob hl5y
    label values age hl6
    label values mline hl12
    label values fline hl14
    label values ed3 ed3
    label def ed3 1 "yes", modify
    label values ed4a ed4a
    label def ed4a 0 "preschool", modify
    label def ed4a 1 "primary", modify
    label def ed4a 2 "lower secondary", modify
    label def ed4a 3 "upper secondary", modify
    label values ed4b ed4b

  • #2
    Well, you do not explain what any of the variables are. From a simple perspective of what can be combined, you can put these data sets together with:
    Code:
    use hh
    merge 1:m hh1 hh2 using hl
    But whether the resulting data set is what you are asking for, or is even anything at all sensible, is impossible to say given the lack of information about what the variables mean.

    Comment


    • #3
      Dear Prof. Clyde,

      Thanks for your reply. I am sorry for insufficient information on the meaning of variables in each dataset.
      As for the hh data, hh1 and hh2 are used to identify household, cline is the children line code in the child labor section (this section is used for households that have at least one child aged 1-17, and the child' mother or father will answer this section), cage is the age of children (1-17 years old).

      Regarding the hl data, hh1 and hh2 are similar to those in the hh data, hl1 is the line code of each member in a household, fline is the father line code of children in the household, mline the mother line code of children in the household. Please note that fathers and mothers in this dataset refer to those who have a child regardless the age of the child, so fline or mline do not necessarily perfectly match the cline in the hl data (e.g., those who have children under the age of 1). age, gender, mob, yob are age, gender, month of birth, and year of birth of each household member. Finally, ed3, ed4a, ed4b refer to education of each household member (please see their labels for more detail).

      I hope things are clearer to you. Happy new year and I wish all the best to you and your family.

      Comment


      • #4
        OK. Thanks. With that explanation, I think what I showed in #2 is the solution to what is posed in #1.

        Happy new year to you and yours as well.

        Comment

        Working...
        X