I have household data and would like to calculate age specific enrollment rates i.e. share of children in at a specific age in a household that are attending school. Below is an example of data with the original (hhid -attend) and desired (age10 - age15) variables
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(hhid pid age attend) float age10 byte age11 float(age12 age13) byte age14 float age15 1 1 10 1 1 0 1 0 0 0 1 2 11 0 1 0 1 0 0 0 1 3 12 1 1 0 1 0 0 0 2 1 10 1 .5 0 .5 0 0 0 2 2 10 0 .5 0 .5 0 0 0 2 3 12 0 .5 0 .5 0 0 0 2 4 12 1 .5 0 .5 0 0 0 3 1 10 0 0 1 0 0 0 0 3 2 11 1 0 1 0 0 0 0 3 3 12 0 0 1 0 0 0 0 3 4 14 0 0 1 0 0 0 0 4 1 15 1 0 0 0 0 0 .5 4 2 15 0 0 0 0 0 0 .5 5 1 10 1 .333 0 0 .5 0 0 5 2 10 1 .333 0 0 .5 0 0 5 3 10 0 .333 0 0 .5 0 0 5 4 13 1 .333 0 0 .5 0 0 5 5 13 0 .333 0 0 .5 0 0 5 6 15 0 .333 0 0 .5 0 0 end
0 Response to Calculate shares by variable and a condition
Post a Comment