Dear List
I have asked this question in different ways before, but it turns out I'm sure what i am doing right or wrong. I think my problem is how i stset my multiple failure data.
i have the following variables:
id
age_at_start_obs
age_at_end_of_obs
age_at_event
event
I want to stset my data so that i can calculate the incidence rates pr age band using fx stptime or by splitting the data by using stsplit
A dummy dataset
I am not sure how to best stset these data to achieve my goal.
I have tried the following
And this seems to give me the results that i what, but i am still wondering:
Is this the correct way to do it?
But when i stsplit my data:
id=1 i would suspect that this individual would have 10 lines in the split dataset, but there are only 9 (age_at_event=50-59).
Could anyone try to explain why that is?
Hope you can look through it and see if I'm off by a mile.
Thank you
Lars
I have asked this question in different ways before, but it turns out I'm sure what i am doing right or wrong. I think my problem is how i stset my multiple failure data.
i have the following variables:
id
age_at_start_obs
age_at_end_of_obs
age_at_event
event
I want to stset my data so that i can calculate the incidence rates pr age band using fx stptime or by splitting the data by using stsplit
A dummy dataset
Code:
input id age_at_start_obs age_at_end_of_obs age_at_event event 1 50 60 55 1 1 50 60 56 1 1 50 60 59 1 2 40 45 . 0 2 40 45 44 1 3 75 80 . 0 3 75 80 76 1 3 75 80 77 1 end
I have tried the following
Code:
replace age_at_event=age_at_end_of_obs if age_at_event==. stset age_at_event, id(id) fail(event) exit(age_at_end_of_obs) enter(age_at_start_obs) stptime, at(35(1)81)
Is this the correct way to do it?
But when i stsplit my data:
Code:
stsplit years, every(1) replace event=0 if event==. tab years event
Could anyone try to explain why that is?
Hope you can look through it and see if I'm off by a mile.
Thank you
Lars
Comment