[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
asad <gunnuox@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: RE: data managment |

Date |
Mon, 8 Jul 2002 11:55:27 -0700 (PDT) |

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. Thanks anyways. - Asad. Nick Cox > There is an FAQ on similar problems at > > http://www.stata.com/support/faqs/data/members.html > > However, your problem looks as if it > could be easier. > > If we sort on -hhold- and within that on -id- then > we can go > > bysort hhold (id) : gen S_age = Age[S_id] > by hhold : gen M_age = Age[M_id] > > This hinges delicately, but sufficiently, on > the fact that under -by:- the subscript is > interpreted within the groups defined by -by:-, > which gives what you want. > > So for first observation > > S_age > > is > > Age[S_id] > > meaning > > age[2] > > interpreted as the value of that > 2nd observation for that -hhold-. > > However, asad mentioned two "problems": > > > (2)In one household (hhold=23), the head has his > > mother present. > > I can't see in what sense this is a problem. You > can't use this procedure to look up a person's mother's age > unless the mother is included in the data as belonging > to the same household. > > > (1)In one household (hhold=45), the head has 2 wives. > > > 45 1 2 . 50 > > 45 2 1 . 40 > > 45 3 . 2 12 > > 45 4 . 2 8 > > 45 5 . 2 5 > > 45 6 3 . 30 > > 45 7 . 3 2 > > 45 8 . 3 5 > > Is that the interpretation? > > 1 and 2 are married to each other; > 3, 4 and 5 have mother 2, so 2 is a wife. > > 7 and 8 have mother 3, but 3 is age 12, > so it looks more like an error to me. > > More generally, whenever a "head" has 2 > or more "wives" it is not clear to me how > this is recorded in your data structure, > nor what you expect the value of spouse's > age to be. If marriage allows polygyny but > not polyandry, then each wife has a unique > husband's age as their spouse's age, but > not vice versa. I may have misinterpreted this, but on a second take I am not at all clear on the rules to be followed. For example, person with -id- 1 in -hhold- 45 and age 50 somehow is mapped into person with -id- 1 and age 40 and spouse 50. Are you in general taking the average of wives' ages? Nick n.j.cox@d... __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: RE: RE: data managment***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: Data management/analysis** - Next by Date:
**st: multinomial probit** - Previous by thread:
**st: RE: data managment** - Next by thread:
**st: RE: RE: data managment** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |