Dear Statalist,
I am trying to figure out 'Age at first birth for man' through their date of birth and their first child's date of birth. However, when I subtract man's date of birth from their first child's date of birth I get no observations.
I have attached a sample data set with this post where var11 on the data set refers to gender; 1 is Male and 2 is female
Below is the code that I used:
Thank you for your help.
Best,
Bibek Sharma
I am trying to figure out 'Age at first birth for man' through their date of birth and their first child's date of birth. However, when I subtract man's date of birth from their first child's date of birth I get no observations.
I have attached a sample data set with this post where var11 on the data set refers to gender; 1 is Male and 2 is female
Below is the code that I used:
Code:
*Age at First Birth tab p150104, m //year of birth. *****Create Man's birth year gen birthyearman=. replace birthyearman=p150104 if man==1 label variable birthyearman"Man's birth year" tab birthyearman, m tab birthyearman ***Create first child's birth year gen birthyearfirst=dobylunar if child==1 tab birthyearfirst, m tab birthyearfirst *Now gen ageatfirstbirth=birthyearfirst-birthyearman label variable ageatfirstbirth"Age at first birth" tab ageatfirstbirth, m tab ageatfirstbirth
Best,
Bibek Sharma
Comment