asad
>
> Thanks Nick, it works.
> Sorry for the error (regarding id of the 2nd wife).
> The corrected data is as follows:
>
> hhold id S_id M_id Age S_age M_age
> 23 1 2 4 35 30 65
> 23 2 1 . 30 35 .
> 23 3 . 2 3 . 30
> 23 4 . . 65 . .
> 45 1 2 . 40 50 .
> 45 2 1 . 50 40 .
> 45 3 . 1 12 . 40
> 45 4 . 1 8 . 40
> 45 5 . 1 5 . 40
> 45 6 2 . 30 50 .
> 45 7 . 6 2 . 30
> 45 8 . 6 5 . 30
>
> As i can see, the commands assign '40' to individual 2
> (i.e. husband) in hhold 45 as his spouse_age. That is,
> In case where the husband has more than one wife, it
> assigns age of the first wife (or whoever is assigned
> as spouse by the surveyor) as the age of the spouse.
>
> Ideally, i wanted it to be an average of the ages of
> the wives (as you have also noted). But this seems
> problematic given the survey design which assigns
> spouse_id for the husband somewhat randomly in
> presence of more than 1 wife.
Good. To reprise, each person has one mother, so
bysort hhold (id) : gen M_age = Age[M_id]
would seem to take care of that, insofar
as mothers are present in the data set.
Let's revisit the Stata problem posed by polygyny.