Hi everyone,
I'm new to this forum and I would really appreciate your help. I tried to look for an answer in this forum and elsewhere on the web but couldn't find a case exactly like mine anywhere. I found similar examples where people had used egen command (egen mother_edu=total(something here), by(hhcode)) but I don't get how that could be used in my case since I don't have any exact rule for who is the mother in the household.
Below is a fictional example of the kind of data I have: I have household survey data where every observation is uniquely identified by an ID code and every household by a household code. Besides this I know what is the member code (two last numbers of the id code) of each respondent in a given household but the codes don't follow any pattern: mothers, fathers and children can have any member code in a given household. I don't have direct information about who is the father and mother in the family, I have only information about what is each respondent's relationship to the household head (household head can be either female or male): spouse, child, grandchild etc.
I would like to add for every observation a variable "mother_edu" to link the the mother's years of education ('edu') to her child/children if the information is available and "." if not. To help with this I know what is the member code of the mother of the respondent (if present in the household). Is there a way to add a variable for mother's idcode for every observation (when available) and proceed from there somehow? Can someone please help me and give an example of how this could be done in the easiest way? Thank you in advance.
Best,
Emmi Hentilä
I'm new to this forum and I would really appreciate your help. I tried to look for an answer in this forum and elsewhere on the web but couldn't find a case exactly like mine anywhere. I found similar examples where people had used egen command (egen mother_edu=total(something here), by(hhcode)) but I don't get how that could be used in my case since I don't have any exact rule for who is the mother in the household.
Below is a fictional example of the kind of data I have: I have household survey data where every observation is uniquely identified by an ID code and every household by a household code. Besides this I know what is the member code (two last numbers of the id code) of each respondent in a given household but the codes don't follow any pattern: mothers, fathers and children can have any member code in a given household. I don't have direct information about who is the father and mother in the family, I have only information about what is each respondent's relationship to the household head (household head can be either female or male): spouse, child, grandchild etc.
I would like to add for every observation a variable "mother_edu" to link the the mother's years of education ('edu') to her child/children if the information is available and "." if not. To help with this I know what is the member code of the mother of the respondent (if present in the household). Is there a way to add a variable for mother's idcode for every observation (when available) and proceed from there somehow? Can someone please help me and give an example of how this could be done in the easiest way? Thank you in advance.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Best,
Emmi Hentilä
Comment