Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to calculate month and year of conception from month/year of birth?

    Hi,

    please consider the following example data

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double id byte month_birth int year_birth
     3030202240518051 12 2007
     3030203390841023  7 2006
      203021309030204  2    .
     3030202240519021  .    .
     3030203300647101  .    .
     3030202240520031  .    .
      203021600880202  7    .
    41030787400024024  .    .
     3030202310676022  2 2004
     3030202240507071  .    .
     3030202240522031  .    .
     3030202210451021  .    .
    41030786200062032  .    .
     3030202250530041  .    .
    41030786700004032  .    .
      203023402540203  6    .
     3030201080176021  .    .
    41030786700007024  .    .
    41030788400046024  .    .
      203020108790206  5    .
    41030784400032024  8 2011
     3030202210447031  .    .
      203020800430201  6    .
      203023402530201  3    .
     3030202250544021  .    .
     3030202260551081  4 2007
    41030785800085024  7 2010
      203021006920201  5    .
     3030202210441051  1 2006
      203023510400202  4    .
      203022201500202  1    .
      203023510400203  8    .
     3030202200434021  .    .
     3030202200425042  6 2004
      203022704660401 11 2001
     3030202350760021  .    .
    41030787000081024  .    .
    41030784900204032 10 2010
     3030202200423031  6 2007
    41030783700269024  .    .
    41030788400100024  .    .
    41030784700029024 12 2010
     3030202210460021  .    .
     3030202200420021  .    .
      203021600930203  4    .
     3030203460993041  .    .
     3030202260568021  1 2007
     3030202260568023  2 2004
     3030202260570011  .    .
    41030786000050024  5 2011
     3030201040067021  .    .
    41030785200057024  .    .
      203023510380401  3    .
      203023605520302 12    .
     3030202190402041  .    .
      203023605570203  9    .
     3030202270575021  .    .
      203023605570204  9    .
      203023707890202  3    .
    41030784000186008  .    .
     3030202120251021  9 2007
     3030203440959021  .    .
     3030202270576021  .    .
      203021403900202  5    .
     3030203440962021  .    .
    41030787800089024  .    .
     3030201340738021  .    .
    41030786900063040  .    .
     3030202270577021  8 2005
      203023402460201  1    .
     3030203360789021  .    .
     3030201340736021  .    .
      203023707890204  2    .
     3030201090189021  .    .
     3030201340734021  .    .
      203020402880203 11    .
     3030203450990031  3 2005
      203020206320203  9    .
    41030787200001032  .    .
    41030786500055024  .    .
     3030202240509021  .    .
      203023510290201 11    .
    41030785900025048  4 2013
     3030203320688021  .    .
     3030202270578021  .    .
    41030783900204024  3 2011
      203022201500203 12    .
      203023708000701  8 2001
    41030788400032024  3 2010
      203021103580205  8    .
     3030202310665021  3 2004
     3030202310679031  .    .
     3030201290622021  6 2008
    41030787600011032  7 2012
    41030784600112024  .    .
      203021103510201  7    .
     3030201290618032  9 2004
      203022504990202  5    .
    41030788100077040  .    .
     3030201280613021  9 2006
    end
    I'm trying to arrive at approx month/year of conception from month/year of birth, based on the assumption that gestation period for a full term pregnancy is 10 months. Unfortunately I dont have date of birth, which I could have used to obtain stata date and count backwards. I looked at similar questions but they had complete date of birth information.

    Is there any way to obtain month/year of conception based on these month/year of birth information? Assuming a full term pregnancy is of 10 months?

    Would appreciate any help.

    Thanks!

  • #2
    First you need to combine the birth year and birth month into a Stata internal format monthly date so that you can do calculations. Once you do that, it's just a matter of subtracting 10:

    Code:
    gen mdate_birth = ym(year_birth, month_birth)
    assert missing(mdate_birth) == missing(year_birth, month_birth)
    format mdate_birth %tm
    
    gen mdate_conception = mdate_birth - 10
    format mdate_conception %tm

    Comment

    Working...
    X