I am currently working with a set of data that contains the Date of Birth (dob) of an observation and the # of Weeks of Gestation at delivery. I am trying to figure out a way to generate a variable which represents the Date of Inception by subtracting the number of weeks of gestation from the dob. So far I've used these commands, but the DoI variable I'm generating is giving me incorrect values which are probably due to week representing the week in year 1960.
*wrong
format dob %tw
gen weekob = wofd(dob)
gen doincep = weekob - gestwk
Any help would be appreciated as I am fairly new to Stata and this forum. Thank you so much for any time and effort!!
Related Posts with Problem with Subtracting Variable that Represents a Number of Weeks from a Date Variable
Location quotient - how to calculateDear all, I would like to know your feedback about something I am struggling with since a lot. I wo…
How to estimate a revised logit model in stataHello, I come across the following revised multinomial logit model for discrete choice in the liter…
Grouping Data by year and GenderHi, I have the following data for years 2012-2016 for males and females in this dataset. The v6, v7…
Starting _n count at particular observationsHey Stata users, I have panel data on subjects and am interesting in how their wages change with ti…
Foreach with leads and lags from numlistHi there, I am sorry if this is a trivial question, but I did not seem to find a satisfactory answe…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with Subtracting Variable that Represents a Number of Weeks from a Date Variable
Post a Comment