Gaby,
First, load the data for all household members and create new
variables with the mother's age, schooling and so on.
. bysort HHnum (Rosternum): gen mage = age[Mothernum]
. bysort HHnum (Rosternum): gen mschool = schooling[Mothernum]
Next, -merge- the household member data with the child data, using the
variables HHnum and Rosternum.
One warning: The commands above only provide the correct ages if there
are no gaps in the roster numbers. For additional information read
these messages in the Statalist archive:
http://www.stata.com/statalist/archive/2006-06/msg00314.html
http://www.stata.com/statalist/archive/2006-06/msg00320.html
http://www.stata.com/statalist/archive/2006-06/msg00321.html
http://www.stata.com/statalist/archive/2006-06/msg00323.html
http://www.stata.com/statalist/archive/2006-06/msg00357.html
Friedrich
On Jan 19, 2008 3:55 PM, Ana Gabriela Guerrero Serdan
<[email protected]> wrote:
> Dear Stata users,
>
> Im trying to match children information with that of
> their mothers. I have two datasets, one includes some
> information for all members of the household and the
> second includes child specific information. I want to
> be able to create a variable in the children's dataset
> about the mothers education levels, age, etc..
>
> My first dataset looks like this:
>
> list HHnum Rosternum Mothernum age HR07 schooling
>
> +--------------------------------------------------------------+
> HHnum Rosternum Mothernum sex age HR32 schooling
> --------------------------------------------------------------
> 1 1 . Male 62 Not elig Has
> atte
> 1 2 . Female 62 Not elig Has
> atte
> 1 3 . Male 41 Not elig Has
> atte
> 1 4 . Female 28 Whole qu Has
> atte
> 1 5 . Male 10 . Has
> atte
> --------------------------------------------------------------
> 1 6 . Male 6 . Has
> atte
> 1 7 . Male 5 . Has
> not
> 1 8 . Male 40 Not elig Has
> atte
> 1 9 . Female 30 Whole qu Has
> atte
> 1 10 . Male 7 . Has
> atte
> --------------------------------------------------------------
> 1 11 . Female 6 . Has
> atte
> 1 12 9 Male 0 . Has
> not
> 1 13 . Male 38 Not elig Has
> atte
> 1 14 . Female 32 Whole qu Has
> atte
> 1 17 . Male 35 Not elig Has
> atte
> 1 18 . Female 29 Whole qu Has
> atte
> 1 19 . Male 8 . Has
> atte
> 1 20 . Female 6 . Has
> not
> --------------------------------------------------------------
> 1 21 18 Female 3 . Has
> not
> 1 22 18 Female 0 . Has
> not
>
>
> So, for household 1, child 12, the mother is 9, for
> household 1, children 21 & 22 mother is 18.
>
> My second dataset is basically a subset of the first
> one but with additional children's information.
>
> list Hhnum Rosternum age sex Mothersnum ,
> etc...
>
> +----------------------------------------+
> Hhnum Rosternum age sex Mothersnum
> ----------------------------------------
> 1. 1 12 Male 0 9
> 2. 1 22 Female 0 18
> 3. 1 21 Female 3 18
> 4. 2 7 Female 1 4
> 5. 2 6 Female 1 4
> ----------------------------------------
> 6. 2 5 Male 3 4
> 7. 3 8 Female 0 .
> 8. 3 7 Male 3 2
> 9. 8 5 Male 2 2
> 10. 19 6 Female 4 2
>
> i have tried a few things like generating new
> variables for mother's var but havent come up with a
> way to do so.
>
> can you suggest anyways to best do the matches?
>
> thanks,
> gaby
>
>
> Gaby Guerrero Serdan
>
> Deparment of Economics
> Royal Holloway, University of London
> TW20 OEX
> Egham, Surrey
> England, UK
> http://www.rhul.ac.uk/economics/About-Us/postgrads.html
> http://www.flickr.com/photos/49939890@N00/
>
> Tel: +44 7912657259
*
* 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/