Hello everybody,
I'm quite new to Stata so sorry if this question might seem a little trivial to you but I just cannot seem to find a solution for the following problem:
I'm working with a data set where each id = one household and the respondent is asked to give information about other household members such as age, gender (over the course of 8 variables for each information [kinship1-kinship8; age1-age etc]
For the first step, I've generated the number of children in each household. The problem that I'm now facing is generating the age and gender of the oldest child in each household.
I've looked into the egen=rowmax() function which seems like the way to go for generating the age.
[egen maxagec=rowmax(age1-age8) if chil > 0] was my first attempt, now knowing that I'm simply generating the max age for households with children in them.
My problem now is to find a way to get the oldest child of the household, not the oldest member of households with children.
After that, I would have to find a way to get to the sex of the oldest child for which I have yet to find the appropriate egen function as well.
I would really appreciate your help with this issue.
Best regards
I'm quite new to Stata so sorry if this question might seem a little trivial to you but I just cannot seem to find a solution for the following problem:
I'm working with a data set where each id = one household and the respondent is asked to give information about other household members such as age, gender (over the course of 8 variables for each information [kinship1-kinship8; age1-age etc]
For the first step, I've generated the number of children in each household. The problem that I'm now facing is generating the age and gender of the oldest child in each household.
I've looked into the egen=rowmax() function which seems like the way to go for generating the age.
[egen maxagec=rowmax(age1-age8) if chil > 0] was my first attempt, now knowing that I'm simply generating the max age for households with children in them.
My problem now is to find a way to get the oldest child of the household, not the oldest member of households with children.
After that, I would have to find a way to get to the sex of the oldest child for which I have yet to find the appropriate egen function as well.
I would really appreciate your help with this issue.
Best regards
Comment