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

st: RE: RE: RE: creating age at first birth from birth historydata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: creating age at first birth from birth historydata
Date   Wed, 28 Apr 2004 17:53:42 +0100

In the original 88 was used as a code for 
missing -child_n-. As this is evidently 
larger than what is possible in practice, 
the effect of this code would be to sort 
all the 88s to low _n, and thus contaminate 
what is kept to the maximum degree. 

If in fact numeric missing were used, 
the same would not apply, which I think 
is what Sidney has in mind. 

Nick 
[email protected] 

Sidney Atwood
 
> I like the bysort but we need to take the highest numbered kid and
> perhaps that birthdate is missing. Try this:
> How about
> 
> gsort momid -child_ n
> by momid:keep if _n==1
> 
> This will produce a dataset with one observation per mother - 
> her first
> born child. Merged back into your mother's dataset will then allow you
> to get mother's age at first birth.
> 
> ssa
>  
> 
> 
> /***********************************
> Sidney Atwood
> Manager
> Instructional Computing Facility
> Harvard School of Public Health
> Kresge, LL-17
> 677 Huntington Avenue
> Boston, MA  02115
> 617-432-3134
> 617-432-4998 - Fax
> ************************************/
> 
> >>> [email protected] 4/26/2004 11:41:37 AM >>>
> I just want to be more clear with the data that I have again:
> 
> I have the following variables: 
> 
> Age of mother, all pregnancies the mother has had (starts with last
> born and
> ends with first born), birthday for each child, an indicator variable
> for
> the child number which runs from 0 to the last child. So, I want the
> reverse
> order for the list of children (first born to last born). 
> 
> There are a total of roughly 16,000 pregnancies for the women and I
> tried
> what Nick suggested but I am just wondering why I am getting the same
> number
> of pregnancies (16,000). I thought the first births would be less than
> the
> 16,000. 
> 
> This is how my data are:
> 
> tab child_n if child_n!=88  (In this case child 1 is last 
> born, child 2
> is
> second to last born etc etc)
> 
>       child |
>      number |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           1 |      4,105       24.71       24.71
>           2 |      3,452       20.78       45.49
>           3 |      2,899       17.45       62.93
>           4 |      2,345       14.11       77.05
>           5 |      1,628        9.80       86.85
>           6 |      1,090        6.56       93.41
>           7 |        607        3.65       97.06
>           8 |        309        1.86       98.92
>           9 |        104        0.63       99.55
>          10 |         47        0.28       99.83
>          11 |         17        0.10       99.93
>          12 |          9        0.05       99.99
>          13 |          2        0.01      100.00
> ------------+-----------------------------------
>       Total |     16,614      100.00
> 
> tab year (year child was born)
> 
>  year child |
>        born |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           0 |        717        4.23        4.23
>           1 |        657        3.88        8.11
>           2 |        653        3.85       11.96
>           3 |        570        3.36       15.32
>          60 |          2        0.01       15.33
>          61 |          1        0.01       15.34
>          62 |          1        0.01       15.34
>          63 |          2        0.01       15.36
>          64 |          1        0.01       15.36
>          65 |          1        0.01       15.37
>          66 |          2        0.01       15.38
>          67 |          5        0.03       15.41
>          68 |          9        0.05       15.46
>          69 |         14        0.08       15.54
>          70 |         45        0.27       15.81
>          71 |         35        0.21       16.02
>          72 |         74        0.44       16.45
>          73 |        112        0.66       17.11
>          74 |        109        0.64       17.76
>          75 |        151        0.89       18.65
>          76 |        174        1.03       19.67
>          77 |        207        1.22       20.90
>          78 |        256        1.51       22.41
>          79 |        253        1.49       23.90
>          80 |        399        2.35       26.25
>          81 |        348        2.05       28.31
>          82 |        347        2.05       30.35
>          83 |        481        2.84       33.19
>          84 |        509        3.00       36.19
>          85 |        487        2.87       39.07
>          86 |        526        3.10       42.17
>          87 |        583        3.44       45.61
>          88 |      1,806       10.65       56.26
>          89 |        525        3.10       59.36
>          90 |        722        4.26       63.62
>          91 |        608        3.59       67.21
>          92 |        610        3.60       70.80
>          93 |        682        4.02       74.83
>          94 |        693        4.09       78.92
>          95 |        700        4.13       83.05
>          96 |        711        4.19       87.24
>          97 |        724        4.27       91.51
>          98 |        638        3.76       95.27
>          99 |        801        4.73      100.00
> ------------+-----------------------------------
>       Total |     16,951      100.00
> 
> I hope this helps
> 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:[email protected]] 
> Sent: 26 April 2004 10:57
> To: [email protected] 
> 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
> [email protected] 
> 
> 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/
> *
> *   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/



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