Announcement

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

  • identify mother father grandmother and grandfather in the household

    Dear All
    I have a data set as following
    clear
    input byte hhrelation double(IDindividul IDfather IDmother) long IDhhid float female double(IDgrandfather IDgrandmother)
    0 111102015001 . . 111102015 1 . .
    1 111102015002 111102015004 . 111102015 0 . .
    3 111102015003 111102015002 111102015001 111102015 1 111102015004 .
    2 111102015004 . . 111102015 0 . .
    0 111103014001 . . 111103014 0 . .
    1 111103014002 . . 111103014 1 . .
    3 111103014003 111103014001 111103014002 111103014 0 . .
    5 111103014004 111103014003 111103014005 111103014 1 111103014001 111103014002
    7 111103014005 . . 111103014 1 . .
    0 212204005001 . . 212204005 0 . .
    1 212204005002 . . 212204005 1 . .
    3 212204005003 . . 212204005 1 . .
    3 212204005004 212204005001 212204005002 212204005 0 . .
    3 212204005005 . . 212204005 0 . .
    7 212204005061 . . 212204005 1 . .
    5 212204005083 212204005004 212204005061 212204005 1 212204005001 212204005001
    5 212204005161 212204005004 212204005061 212204005 0 212204005001 212204005001
    end

    IDhhid: Household id
    IDindividul: member id
    female: 0:Male, 1: Female
    hhrelation: relationship to the head,0: head of household,1: spouse,2: father/mother,3: son/daughter,4 :brother/sister,5: grandson-in-law/grand-daughter-in-law,6 :mother-in-law/ father-in-law ,7: son-in-law/ father mother ,8: other relative,9 :maid ,10, other non-relative
    I want to have four columns IDfather ,IDmother ,IDgrandfather and IDgrandmother, which are part of IDindividul.
    I don't know how to do the codes.


    Please help me.

    Thank you so much

  • #2
    Dear All
    I have a data set as following(the up one is wrong)
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte hhrelation double(IDindividul IDfather IDmother) long IDhhid float female double(IDgrandfather IDgrandmother)
    0 111102015001 . . 111102015 1 . .
    1 111102015002 111102015004 . 111102015 0 . .
    3 111102015003 111102015002 111102015001 111102015 1 111102015004 .
    2 111102015004 . . 111102015 0 . .
    0 111103014001 . . 111103014 0 . .
    1 111103014002 . . 111103014 1 . .
    3 111103014003 111103014001 111103014002 111103014 0 . .
    5 111103014004 111103014003 111103014005 111103014 1 111103014001 111103014002
    7 111103014005 . . 111103014 1 . .
    0 212204005001 . . 212204005 0 . .
    1 212204005002 . . 212204005 1 . .
    3 212204005003 . . 212204005 1 . .
    3 212204005004 212204005001 212204005002 212204005 0 . .
    3 212204005005 . . 212204005 0 . .
    7 212204005061 . . 212204005 1 . .
    5 212204005083 212204005004 212204005061 212204005 1 212204005001 212204005002
    5 212204005161 212204005004 212204005061 212204005 0 212204005001 212204005002
    end

    Comment

    Working...
    X