Dear SAS community,
I am a bit rusty with my SAS skills. I am trying to set up a counting process dataset for cox proportional hazards model.
tstart = start of the interval (year)
tstop = end of the interval (year)
expo1 and expo2 = time dependent covariates (1 = yes, 0 = no)
Here is a person whose life started at year 1. At age 4, the person got exposed to expo2, and at age 12 got exposed to expo1. The interval will end at year 21 (got censored/interviewed at that point). My current dataset looks like this:
obs tstart tstop expo1 expo2
1 1 4 0 0
1 4 5 0 1
1 5 12 0 1
1 12 13 1 1
1 13 21 1 1
Here is the bit that i struggled with:
I would like to add additional intervals below row 4 as soon as the "expo1" variable is coded 1. Ideally i wanted my dataset to look like that where the immediate row after [12,13] is 1 year after expo1, 2 years after expo1 and 5 years after expo1.
How do i code this in sas?
obs tstart tstop expo1 expo2
1 1 4 0 0
1 4 5 0 1
1 5 12 0 1
1 12 13 1 1
1 13 14 1 1
1 14 16 1 1
1 16 21 1 1
Thanks very much in advance.