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
In SEM, calculating SE of standardized total effects and indirect effectsI'm fitting a SEM model, and everything is fine except the paper's reviewers want standardized total…
Significance of variablesHello, I have one doubt about the significance of an independent variables. In my database I have e…
Svyset command "unrecognized" in Stata 15Hi everyone, I have a puzzling problem. I'm using Stata 15 and when I try to svyset, I get an error…
How does Stata select bootstrap samples?If I understand it correctly, when using the -vce(bootstrap)- command for a regression, Stata will r…
Reshape wide errorI'm using Stata 15.1 on a Windows 10 machine I'm struggling to get my head around -reshape- (again)…
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