Hello,
I have an individual (child) level panel data. In the data set, I have child's ID (CYRB_XRND), mother's ID (MPUBID), the number of children each mother has (num_children), the rank of each child among siblings (rank_child), and educational level (educ).
I want to calculate the average educational level of older siblings for each child every year. Here, I can't use rangestat or asrol by MPUBID*year groups because not only do I need to exclude the value of self educational level, but also younger siblings' (indicated by rank_child). Could someone help me figure out the best way to approach this?
Thank you!
I have an individual (child) level panel data. In the data set, I have child's ID (CYRB_XRND), mother's ID (MPUBID), the number of children each mother has (num_children), the rank of each child among siblings (rank_child), and educational level (educ).
HTML Code:
bysort MPUBID: egen num_children = nvals(CPUBID) bysort MPUBID (CYRB_XRND) : gen rank_child = CYRB_XRND != CYRB_XRND[_n-1] by MPUBID : replace rank_child = sum(rank_child)
Thank you!
Comment