Statalist


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

Re: st: matching childrens to mothers information


From   Ana Gabriela Guerrero Serdan <[email protected]>
To   [email protected]
Subject   Re: st: matching childrens to mothers information
Date   Sun, 20 Jan 2008 07:23:22 -0800 (PST)

Sorry Maarten but I didnt explain myself correctly. 

If I would have a unique identifier to match children
and mothers I would use it. What I have is a variable
for each children called mothersnum which tells me the
roster num of the mother. For mothers there is no
indication of what is the roster number of the child.
So if I merge mothersnum in children database with var
mothersnum in full database I would get nothing since
the mothersnum in the full database is "." If I use
roster number I would then only match children with
themselves. 

Apologies if this was a confusing query but here is
what I have worked out and seems to be working now. 

I have created a new identifier (id). 

In full database:

gen id=rosternum 
gen msex=sex */doesnt necessarily reflects only mother
but just to differentiate from the sex var of children
with is also sex*/ 

gen mage=age */doesnt necessarily reflects only mother
but just to differentiate from the age var of children
with is also age*/ 

gen edumother=education */doesnt necessarily reflects
only mother but just to differentiate from the
education var of children with is also education*/ 

sort hhnum id
save as "mothersdatabase" 

list hhnum  roster id mothersnum mage msex edumother

+---------------------------------------------------------+
hhnum   roster   id   mother~m   mage   msex  
edumot~r 
---------------------------------------------------------
1.      1        1    1       .     62      1        1

2.      1        2    2       .     62      2        1

3.      1        3    3       .     41      1        1

4.      1        4    4       .     28      2        1

5.      1        5    5       .     10      1        1

---------------------------------------------------------
............
---------------------------------------------------------
11.      1       11   11       .      6      2       
1 
12.      1       12   12       9      0      1       
2 
13.      1       13   13       .     38      1       
1 
14.      1       14   14       .     32      2       
1 
15.      1       15   15       .     10      1       
1
---------------------------------------------------------
............
---------------------------------------------------------
21.      1       21   21         18      3      2    
2 
 ..........

In childrens database:
gen id=mothersnum
sort hhnum id 
save
merge hhnum id using "mothersdatabase", nokeep 

list AI01 HR01 id sex age mothernum msex mage
edumother


+------------------------------------------------------------------+
AI01   HR01 id  sex  age  mot~rnum  msex  mage
edumot~r 

------------------------------------------------------------------
1.1     12    9     1     0     9      2     30      
1
2.1     21   18     2     3    18      2     29      
1 
3.1     22   18     2     0    18      2     29      
1 
4.2      6    4     2     1     4      2     25      
1 
5.2      7    4     2     1     4      2     25      
1 

------------------------------------------------------------------
.........


So for child with rosternum 9 the mothers msex=2
(female ofcourse!) and mage=30. 

Again apologies for my confusion. 

regards, 
Gaby 







--- Maarten buis <[email protected]> wrote:

> If you would manually match a child to a mother,
> what variables would
> you use?
> 
> --- Ana Gabriela Guerrero Serdan
> <[email protected]> wrote:
> 
> > Dear Maarten, 
> > 
> > Yes, ofcourse. The problem is that if I merge by
> using
> > hhnumber and mothers number there is a mismatch
> > because it means i merge the children dataset with
> its
> > own number as it is indicated in the
> mothersnumber. I
> > cant use roster number neither. 
> > 
> > I have created an additional identifier for each
> of
> > them. So i can merge child rosternumb 12 with
> mother
> > rosternum 9. Here is waht I have tried generating
> an
> > additional id to be used for both datasets. 
> > 
> > In childrens dataset: 
> > gen id= Mothernum
> > 
> > In other dataset:
> > gen id=rosternum
> > 
> > 
> > sort Hhnum id
> > 
> > merge Hhnum id using " dta"
> > 
> > but i somehow dont get the mothers variables
> > adequately into the children's dataset. 
> > 
> > 
> > txs, 
> > Gaby 
> > 
> > --- Maarten buis <[email protected]> wrote:
> > 
> > > Did you take a look at -merge- ?
> > > 
> > > -- Maarten
> > > 
> > > --- 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? 
=== message truncated ===



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

*
*   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/



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