Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: creating age at first birth from birth history data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: creating age at first birth from birth history data
Date   Mon, 26 Apr 2004 10:56:45 +0100

I'll guess at your data structure. If this 
isn't correct, you may need to say more 
about it. 

I assume some identifier variable 
and a variable containing dates of birth
of children, as in 

mother birthdate 
1       1feb2001
1       1mar1999
1       4jul1996 
1       28feb1994
2       2nov2003 
2       etc. 
3
3
3
3

I also assume -birthdate- is a Stata
elapsed date. 

Your problem at its simplest is that 
the birthdates are in the reverse order
fom what you want. 

bysort mother (birthdate) : gen first = birthdate[1] 

will generate a variable with firstbirths from 
these data. The same value of -first- will be 
repeated for each -mother-. To get the age
of the mother at the first birth, you may 
need to subtract the mother's date of birth, 
possily in another variable. 

Nick
n.j.cox@durham.ac.uk 

Henry DOCTOR

> I need to create a variable called "age at first birth" 
> for women from birth history data. The variable has information 
> for births beginning with the last child (most recent birth) 
> to the first child (first pregnancy). So, every woman has n 
> children and the last (nth child) in the data is the first born. 
> I want to reverse this so that the variable gives me the nth 
> child for every woman as the first born.


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index