Hi people,
Supposed i want to measure marriage timing among pregnant and non pregnant adolescents (age 13 to 19) using cmc variables, how do i go about creating my duration variable in this case. I have already created the event, which is experiencing 1st marriage. Below are some of the steps i followed:

Event Variable (1st Marriage):
tab v509 /*date of 1st cohabitation (cmc)*/
tab v511 /*age at first cohabitation in years*/
gen EVENT_1STMAR = .
replace EVENT_1STMAR = 1 if v509 !=. & v511 >= 13 | v511 <=19
replace EVENT_1STMAR = 0 if v509 ==. & v511 <=12 | v511 >=20
tab EVENT_1STMAR, m

Now Duration:
tab v010 /*respondent's year of birth*/
tab v508 /*respondent's year of first cohabitation*/
tab v011 /*date of birth (cmc)*/
tab v008 /*Date of interview (cmc)*/

gen DURATION =.
replace DURATION = (v508 - v010 )*12 + v011 - v509 if EVENT_1STMAR == 1
replace DURATION = v008 if EVENT_1STMAR == 0

Note: the duration should start at age 13 and end when the respondent turns 20 or month of interview or at 1st cohabitation. This is where my problem!

Your comments and guidance will be highly appreciated.

Thanks in advance.