Hi there,

I'm currently working on a data that consist of 'date of birth' and 'gestational age' in weeks. I will like to estimate 'pregnancy period' by subtracting 'gestational age' at birth from 'date of birth'. Given the fact that the two variables are in different formats, one in date format and another in weeks format, how do I solve this problem?



Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str9 bdob byte gestage
"01JAN2007" 41
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 41
"01JAN2007" 38
"01JAN2007" 42
"01JAN2007" 40
"01JAN2007" 38
"01JAN2007" 41
"01JAN2007" 40
"01JAN2007" 38
"01JAN2007" 39
"01JAN2007" 38
"01JAN2007" 36
"01JAN2007" 38
"01JAN2007" 34
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 37
"01JAN2007" 34
"01JAN2007" 38
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 37
"01JAN2007" 40
"01JAN2007" 37
"01JAN2007" 39
"01JAN2007" 41
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 37
"01JAN2007" 40
"01JAN2007" 41
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 41
"01JAN2007" 38
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 38
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 37
"01JAN2007" 40
"01JAN2007" 41
"01JAN2007" 39
"01JAN2007" 37
"01JAN2007" 40
"01JAN2007" 38
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 40
"01JAN2007" 38
"01JAN2007" 38
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 40
"01JAN2007" 41
"01JAN2007" 39
"01JAN2007" 42
"01JAN2007" 38
"01JAN2007" 40
"01JAN2007" 40
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 40
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 41
"01JAN2007" 38
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 39
"01JAN2007" 37
"01JAN2007" 39
"01JAN2007" 28
"01JAN2007" 40
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 37
"01JAN2007" 40
"01JAN2007" 38
"01JAN2007" 36
"01JAN2007" 38
"01JAN2007" 38
"01JAN2007" 39
"01JAN2007" 40
"01JAN2007" 40
"01JAN2007" 39
end
Please help.

Thank you.