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
Setup data correctly for survival analysis - stset - without losing observationsDear all, i was hoping someone might be able to help me set up my data correctly so i can use it in …
Concatenation ignoring order and repeatsI have 6 categorical variables taking on one response per observation. These variables represent fie…
using loop to replaceI am currently using the following code but i have been advice to use shorter codes. I tried using l…
Concatenation ignoring order and repeatsI have 6 categorical variables taking on one response per observation. These variables represent fie…
Concatenation ignoring order and repeatsI have 6 categorical variables taking on one response per observation. These variables represent fie…
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