Thanks to Nick Cox for the reply. I will try what you have suggested and get
back to you if I experience any problems. In the interim it looks like you
have guessed right about the data.
Henry
********************************************************
Henry V. Doctor
Navrongo Health Research Centre
P.O. Box 114
Navrongo, Upper East Region
GHANA
tel/fax: +233 (0)742 22320; cell: +233(0)244 433706
********************************************************
-----Original Message-----
From: Nick Cox [mailto:n.j.cox@durham.ac.uk]
Sent: 26 April 2004 10:57
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: creating age at first birth from birth history data
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/
*
* 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/