Announcement

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

  • this is a test

    Dear all,
    I need to create a variable which identifies, for each individual, the following statuses: Childless individual (x = 0); Parents in couple, living with children (x = 1); Single parent, non-resident with children (x = 2); and Single parent, co-resident with children (x = 3).

    Can someone please help me? Thank you very much! I think I need some kind of loop but I can't find the solution on my own. I have the following variables in a panel dataset:

    wave: year of the survey
    pid: personal identifier
    hhid: household identifier
    headid: head of the household identifier
    link: link to the head of the household (e.g., 0= reference person, 1= husband/wife, 2= brother/sister)
    pid_parent1: parent1 personal identifier (parent affiliation with children’s pid)
    pid_parent2: parent2 personal identifier (parent affiliation with children’s pid)
    hhtype: household type (e.g., 0= single, childless, 1= single, with child, 2= in couple, childless)


    My problem is that the variable “hhtype” doesn't allow me to identify non-resident household members.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int wave str16 pid float hhid str16 headid byte link str16(pid_parent1 pid_parent2) str10 hhtype
    2000 "8A47EDF23C255104" 30074674 "8A47EDF23C255104"  1 "9CE6E2CD8D9E0967" "1F56F1A97B14F2D0" "12"
    2001 "8A47EDF23C255104" 30073988 "8A47EDF23C255104"  1 "9CE6E2CD8D9E0967" "1F56F1A97B14F2D0" "12"
       . "8A47EFC1D78B2B46"        . ""                  . " "                " "                ""    
       . "8A47EFC1D78B2B46"        . ""                  . " "                " "                ""    
    2000 "8HUYJ27AE2740D42" 30411832 "DFB9AC98F5E3FA7A"  3 "DFB9AC98F5E3FA7A" "2812904AD0AC7AAE" "12"
    2001 "8HUYJ27AE2740D42" 30410376 "DFB9AC98F5E3FA7A"  3 "DFB9AC98F5E3FA7A" "2812904AD0AC7AAE" "12"
       . "8HUYJ28FFEC10247"        . ""                  . "2FDA53ADA71EF4E0" " "                ""    
       . "8HUYJ28FFEC10247"        . ""                  . "2FDA53ADA71EF4E0" " "                ""    
    2000 "8HUYJ32BE8D6104C" 20395584 "74087C059D291E86"  3 "037C1D94D73DD51A" "74087C059D291E86" "13"
    2001 "8HUYJ32BE8D6104C" 20399144 "74087C059D291E86"  3 "037C1D94D73DD51A" "74087C059D291E86" "13"
       . "8HUYJ350890281F2"        . ""                  . "644A77491532D805" "318B370004E2BE73" ""    
       . "8HUYJ350890281F2"        . ""                  . "644A77491532D805" "318B370004E2BE73" ""    
    2000 "8HUYJ4A99DE56F36" 20702236 "8HUYJ4A99DE56F36"  1 "3D958D9B9B2C0CE5" "C8ADB0A0AD138BA0" "22"
    2001 "8HUYJ4A99DE56F36" 30414460 "8HUYJ4A99DE56F36"  1 "3D958D9B9B2C0CE5" "C8ADB0A0AD138BA0" "12"
    2000 "8HUYJ5A1E276A1BB" 30070316 "8HUYJ5A1E276A1BB"  1 " "                " "                "12"
    2001 "8HUYJ5A1E276A1BB" 20077826 "8HUYJ5A1E276A1BB"  1 " "                " "                "22"
    2000 "8HUYJ600771F2205" 20692674 "8HUYJ600771F2205"  1 "DF1BB0137D277C6C" "CBF20E0A533ACFCF" "25"
    2001 "8HUYJ600771F2205" 20700692 "8HUYJ600771F2205"  1 "DF1BB0137D277C6C" "CBF20E0A533ACFCF" "25"
       . "8HUYJ895345AFAF8"        . ""                  . "2F6DC1B6B344C5FE" "509B7597B177EC06" ""    
       . "8HUYJ895345AFAF8"        . ""                  . "2F6DC1B6B344C5FE" "509B7597B177EC06" ""    
    2000 "8HUYJ8EBABD97712" 30160574 "85A2744174D3D16B"  3 "85A2744174D3D16B" "032B3F0DBD7488A4" "12"
    2001 "8HUYJ8EBABD97712" 30159324 "85A2744174D3D16B"  3 "85A2744174D3D16B" "032B3F0DBD7488A4" "12"
    2000 "8HUYJ9669EBC739C" 30110714 "8977AD4E8BEA8257"  2 "F0ABF1DE6A43794D" "0C1E850B77C07F0F" "12"
    2001 "8HUYJ9669EBC739C" 30109768 "8977AD4E8BEA8257"  2 "F0ABF1DE6A43794D" "0C1E850B77C07F0F" "12"
       . "8HUYJA13A9954D68"        . ""                  . "F38B2C2EA6316F4C" "99FDAB3744A98129" ""    
       . "8HUYJA13A9954D68"        . ""                  . "F38B2C2EA6316F4C" "99FDAB3744A98129" ""    
    2000 "8HUYJABBBE507D78" 31180656 "8HUYJABBBE507D78"  1 "5DADE26D41C24ADC" "97D1AE74E14591BD" "12"
    2001 "8HUYJABBBE507D78" 31174480 "8HUYJABBBE507D78"  1 "5DADE26D41C24ADC" "97D1AE74E14591BD" "12"
       . "8HUYJB030E64971B"        . ""                  . " "                " "                ""    
       . "8HUYJB030E64971B"        . ""                  . " "                " "                ""    
       . "8HUYJBC805AFE178"        . ""                  . "6011F6042D2A231F" "195BECE24EE0E67D" ""    
       . "8HUYJBC805AFE178"        . ""                  . "6011F6042D2A231F" "195BECE24EE0E67D" ""    
       . "8HUYJE0EC5D0B528"        . ""                  . "25063F8A479EF0F5" "6E0CF06E330EB7EC" ""    
       . "8HUYJE0EC5D0B528"        . ""                  . "25063F8A479EF0F5" "6E0CF06E330EB7EC" ""    
    2000 "8HUYJF611F4CFEF4" 30098148 "8HUYJF611F4CFEF4"  1 " "                " "                "12"
    2001 "8HUYJF611F4CFEF4" 30097304 "8HUYJF611F4CFEF4"  1 " "                " "                "12"
    2000 "980U01D75F92AE49" 31332120 "AE500B70D5B901E7"  3 "AE500B70D5B901E7" " "                "12"
    2001 "980U01D75F92AE49" 21144020 "4486B8DE2C42ADE0" 22 "AE500B70D5B901E7" " "                "25"
    2000 "980U0226F7496F34" 30454348 "4FCC110A02B081CB"  3 "4FCC110A02B081CB" "ED0AB4A570FF045A" "12"
    2001 "980U0226F7496F34" 30452874 "4FCC110A02B081CB"  3 "4FCC110A02B081CB" "ED0AB4A570FF045A" "12"
    2000 "980U0367A4D9AF03" 21092720 "DCCBCD168C0CB2A6"  2 " "                " "                "22"
    2001 "980U0367A4D9AF03" 21104028 "DCCBCD168C0CB2A6"  2 " "                " "                "22"
       . "980U094C0ED14755"        . ""                  . "ECE50D8380ED729D" "D662C363DCCB26D4" ""    
       . "980U094C0ED14755"        . ""                  . "ECE50D8380ED729D" "D662C363DCCB26D4" ""    
    2000 "980U0C3DE6264EEC" 30306404 "1E8F1921BC8D794D"  3 "1E8F1921BC8D794D" "FBE1D5052B8948CD" "12"
    2001 "980U0C3DE6264EEC" 30305140 "1E8F1921BC8D794D"  3 "1E8F1921BC8D794D" "FBE1D5052B8948CD" "12"
    2000 "980U0EDE3CE1A33E" 21297586 "980U0EDE3CE1A33E"  1 "A11DA74A33AA2179" "1D55F2085F1AB972" "25"
    2001 "980U0EDE3CE1A33E" 21312752 "980U0EDE3CE1A33E"  1 "A11DA74A33AA2179" "1D55F2085F1AB972" "25"
       . "980U0FEC70C0FA60"        . ""                  . " "                " "                ""    
       . "980U0FEC70C0FA60"        . ""                  . " "                " "                ""    
    2000 "980U1162BEC3D0F7" 21063796 "9C0FD84F920FB27D"  3 "F366417BF80AA5C0" "9C0FD84F920FB27D" "13"
    end
    label values n3lien n3lien
    label def n3lien 1 "REFERENCE", modify
    label def n3lien 2 "husband,wife", modify
    label def n3lien 3 "son,daughter", modify
    label def n3lien 22 "other,unrelated age 16+", modify
Working...
X