Dear Stata community,
I am conducting a study on child labor in my country, using data from Household Surveys. Since my regression will be performed only on the analysis units (i.e. minors), I am interested in creating variables that include relevant information about their parents, such as age, race, education, etc. My data has the usual format, with both the household and individual identifiers (hh_id and id), and a particular variable that identifies the children's mother and father (or tutor) by their own ID (below, I include father_id). Note that if the father or mother is not present in the household, this is recorded as '997'. Additionally, I have created a dummy to identify all minors called child.
My question is how can I create a variable that, for example, shows the father's age for each child, considering the possibility that within a household there may be more than one father. Thank you all in advance for any commentary or suggestion.
I am conducting a study on child labor in my country, using data from Household Surveys. Since my regression will be performed only on the analysis units (i.e. minors), I am interested in creating variables that include relevant information about their parents, such as age, race, education, etc. My data has the usual format, with both the household and individual identifiers (hh_id and id), and a particular variable that identifies the children's mother and father (or tutor) by their own ID (below, I include father_id). Note that if the father or mother is not present in the household, this is recorded as '997'. Additionally, I have created a dummy to identify all minors called child.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str22 hh_id byte(id gender age) float child int father_id "111-00416110273-A-0021" 1 1 42 0 997 "111-00416110273-A-0021" 2 2 36 0 997 "111-00416110273-A-0021" 3 1 19 0 1 "111-00416110273-A-0021" 4 2 13 1 1 "111-00416110273-A-0021" 5 1 3 0 1 "111-00416110273-A-0021" 6 2 86 0 997 "111-00416110273-A-0031" 1 1 44 0 997 "111-00416110273-A-0031" 2 2 32 0 997 "111-00416110273-A-0031" 3 2 11 1 1 "111-00416110273-A-0031" 4 2 3 0 1 "111-00416110273-A-0051" 1 1 41 0 997 "111-00416110273-A-0051" 2 2 31 0 997 "111-00416110273-A-0051" 3 2 14 1 1 "111-00416110273-A-0051" 4 2 13 1 1 "111-00416110273-A-0051" 5 1 8 1 1 end label values gender gender label def gender 1 "1.men", modify label def gender 2 "2.women", modify