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
Using postfile with xtregHi guys, I would like to perform a regression within a loop and store the results in excel. Ideally…
How I can egen a variable to capture the sum value of numbers in the different columnsDear Stata users, I am working on a dataset with many dummy variables. What I want to achieve is eg…
Web scarping errorHello all, I downloaded the command nba2stata to get data from this website to STATA. However when …
Can PPML be used beyond gravity models?Dear All, I am helping a friend with some Stata coding. I am myself not an expert. They have a cou…
Error specifying multiple quantilesI am trying to run quantile regression with clustered standard errors. I would like to run .25, .5 .…
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