Hi everyone,
I want to create a variable that is a count of days between two events. In my study, there are two potential starting events (Procedure A and Procedure B) and two potential ending dates (Outcome or Study End). For Procedure A, there is one index date from which I want to start counting time. For procedure B, there is an index date, but this event may be followed by another event of the same type ('last procedure date'). For Procedure B, I want to start counting time from the latest of either the index date or the last procedure date. For both procedures, I want to count time to the date of either the Outcome or the Study End. Once I have this count in days, I want to convert it to weeks, months, and years (but that's a second step problem).
My thinking so far is I need code in the logic for the start date and then follow that up with code for the end date. The example code I have for this in SAS and uses the INTCK function, which offers limited value in Stata, and I'm struggling to figure out quite how to get started. I'd welcome any suggestions of resources to read or code to look at to help me construct this variable.
Thank you!
Related Posts with Constructing a Time-to-Event Variable (days) with Multiple Potential Start Dates and a Two Potential End Dates
Twoway graph of treated/control means by group with smoothingHi all, I am trying to generate some plots using the means for treatment/control group for various g…
Multiple conditions within loopHello, Stata Users! My question might seem too simple, but I am struggling with generating new vari…
Matching data in a case controlHello there, I am trying to match data for a case control study on a positive cancer diagnosis on b…
random fixed effect model of panel dataHi, I am trying to anlysis an (unbalanced) panel data which covers around 6000 companies (79000 fri…
-catplot-: Suppress automatic title under x-axis?Dear all, I am creating a graph much like this: Code: sysuse auto, clear catplot rep78, over(forei…
Subscribe to:
Post Comments (Atom)
0 Response to Constructing a Time-to-Event Variable (days) with Multiple Potential Start Dates and a Two Potential End Dates
Post a Comment