Hello Statalist,
This question is regarding survival data where subjects can potentially exit and re-enter observation multiple times before failure or censoring.
The panel data are in long format with each observation ending in failure, censoring, or non-failure exit with subsequent re-entry. Each panel has a single origin date when the subject was first at risk (dc_date) and each observation has unique entry (t0) and exit dates (t1) for when the subject was under observation.
I am using stsplit to stratify observations into risk levels by times of 0, 30, 60, 90 days from t0, which works well for the first (or only) observation in a panel.
The problem I’m having is with “resetting” the stsplit at 0, so the splits begin counting from the t0 of the second (or subsequent) observations rather than study origin.
I’ve tried multiple strategies, including: 1) changing the stset origin[] and enter[] variables and 2) creating a dummy variable “order” for observation sequence and using:
stsplit [newvar] if (order==1), at (30 60 90 180 360) then
stsplit [newvar] if (order==2), at (30 60 90 180 360)
Regardless, I’m always ending up with the stsplist for observations after _n=1 counting from the panel origin date (dc_date) rather than from t0 of that observation.
I appreciate any suggestions.
thanks, Christy
This question is regarding survival data where subjects can potentially exit and re-enter observation multiple times before failure or censoring.
The panel data are in long format with each observation ending in failure, censoring, or non-failure exit with subsequent re-entry. Each panel has a single origin date when the subject was first at risk (dc_date) and each observation has unique entry (t0) and exit dates (t1) for when the subject was under observation.
I am using stsplit to stratify observations into risk levels by times of 0, 30, 60, 90 days from t0, which works well for the first (or only) observation in a panel.
The problem I’m having is with “resetting” the stsplit at 0, so the splits begin counting from the t0 of the second (or subsequent) observations rather than study origin.
I’ve tried multiple strategies, including: 1) changing the stset origin[] and enter[] variables and 2) creating a dummy variable “order” for observation sequence and using:
stsplit [newvar] if (order==1), at (30 60 90 180 360) then
stsplit [newvar] if (order==2), at (30 60 90 180 360)
Regardless, I’m always ending up with the stsplist for observations after _n=1 counting from the panel origin date (dc_date) rather than from t0 of that observation.
I appreciate any suggestions.
thanks, Christy
Comment