Dear Statalisters,
I would like to ask for advice regarding creating person ID variables from a household survey panel data.
I have appended together 3 years of household survey data to construct a panel for use in my masters thesis. The datasets share a common household identifier (zzhhid), but none for individuals. There is a variable for respondent line number (lno) for each household member, but further checking showed that the lc101_lno_ can change year from year since members may move in/out of the household.
I attach below a sample of the dataset to better illustrate my problem. I have sorted out the dataset using below command just to preview which observations makes sense to use for the panel. The sorting isnt perfect as you can see, but it allows me to check at least whether which observations make sense, given the lack of an personID variable. Hope you can advise me on how I can construct a person ID variable in this case. Thank you in advance!
I would like to ask for advice regarding creating person ID variables from a household survey panel data.
I have appended together 3 years of household survey data to construct a panel for use in my masters thesis. The datasets share a common household identifier (zzhhid), but none for individuals. There is a variable for respondent line number (lno) for each household member, but further checking showed that the lc101_lno_ can change year from year since members may move in/out of the household.
I attach below a sample of the dataset to better illustrate my problem. I have sorted out the dataset using below command just to preview which observations makes sense to use for the panel. The sorting isnt perfect as you can see, but it allows me to check at least whether which observations make sense, given the lack of an personID variable. Hope you can advise me on how I can construct a person ID variable in this case. Thank you in advance!
Code:
gsort zzhhid rel lno age sex -year
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str18 zzhhid float year byte(lno rel sex age marstat educ) "1010A2226" 2003 1 1 2 68 3 2 "1010A2226" 2006 1 1 2 72 3 1 "1010A2226" 2009 1 1 2 75 3 1 "1010A2226" 2009 2 3 1 35 2 5 "1010A2226" 2009 4 5 2 37 2 4 "1010A2332" 2003 1 1 1 68 2 1 "1010A2332" 2006 1 1 1 72 2 1 "1010A2332" 2009 1 1 1 74 2 2 "1010A2332" 2003 2 2 2 63 2 2 "1010A2332" 2006 2 2 2 67 2 2 "1010A2332" 2009 2 2 2 69 2 2 "1010A2332" 2003 3 3 1 33 1 5 "1010A2332" 2006 3 3 1 35 1 4 "1010A2332" 2009 3 3 1 39 1 5 "1010A2332" 2003 4 3 2 22 1 5 "1010A2332" 2006 4 3 2 25 1 5 "1010A2332" 2009 4 3 2 28 1 5 "1010A2332" 2003 5 3 2 39 1 4 "1010A2332" 2006 5 3 2 41 1 4 "1010A2332" 2009 5 3 2 45 1 4 "1010A2332" 2006 6 6 2 15 1 3 "1010A2332" 2006 7 6 1 5 1 0 "1010A2440" 2003 1 1 1 50 2 2 "1010A2440" 2006 1 1 1 54 2 2 "1010A2440" 2009 1 1 2 55 3 4 "1010A2440" 2003 2 2 2 49 2 2 "1010A2440" 2006 2 2 2 52 2 2 "1010A2440" 2009 2 3 1 23 1 5 "1010A2440" 2003 3 3 1 24 1 3 "1010A2440" 2006 3 3 1 26 1 2 "1010A2440" 2009 3 3 1 30 2 4 "1010A2440" 2003 4 3 1 23 1 3 "1010A2440" 2006 4 3 2 23 1 1 "1010A2440" 2003 5 3 2 20 1 2 "1010A2440" 2006 5 3 1 22 1 4 "1010A2440" 2003 6 3 1 19 1 3 "1010A2440" 2003 7 3 2 17 1 3 "1010A2440" 2009 8 3 2 22 2 4 "1010A2440" 2009 4 5 2 25 2 4 "1010A2440" 2009 7 5 1 22 2 4 end label values rel REL label def REL 1 "Head", modify label def REL 2 "Wife/Spouse", modify label def REL 3 "Son/daughter", modify label def REL 5 "Son/daughter_law", modify label def REL 6 "Grandchildren", modify label values sex SEX label def SEX 1 "Male", modify label def SEX 2 "Female", modify label values marstat MSTAT label def MSTAT 1 "Single", modify label def MSTAT 2 "Married", modify label def MSTAT 3 "Widowed", modify label values educ GRADE label def GRADE 0 "No Grade Completed", modify label def GRADE 1 "Elementary Undegraduate", modify label def GRADE 2 "Elementary Graduate", modify label def GRADE 3 "Highschool Undergraduate", modify label def GRADE 4 "Highschool Graduate", modify label def GRADE 5 "Collge Undergraduate", modify
Comment