Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72787

stset and than stsplit into risk years

$
0
0
Dear List
I have a dataset of events, i want to calculate the incidence rates for the event for each life year
my observations period is from 1977-2012, and each participant can have the event more than once (multiple failures).
my variables:
id = unique id pr individual in the studu
age_at_start_obs = the age at the start of the observation (given you are born before 1977 its the age in 1977, given you are born after 1977 you enter at birth age 0)
age_at_end_of_obs = right censored age (age at end of ons, death or migration)
failure = if you have had the event (0/1)
age_at_failure = the age you were when you failed


Now, i want to calculate the age specific incidence rates.
so in my mind i need to
1) stset the data
Code:
 stset age_at_end_of_obs, fail(failure) id(id) exit(time .)
2) stsplit my data into chunks of 1 year pr id so that for every year since entering the study (age_at_start_obs) there is a failure variable that is 0 or 1
for example: If you are in the study from you are 10 until you turn 20 and fail once at age 15 your data would look like:
Code:
input byte (id fail age)
1 0 10
1 0 11
1 0 12
1 0 13
1 0 14
1 1 15
1 0 16
1 0 17
1 0 18
1 0 19
1 0 20
end
but when i go:
Code:
stset age_band, every(1)
after my stset code above, i do not get what i desire, but ages that stop at age_at_start_obs

what am i doing wrong?

lars


Viewing all articles
Browse latest Browse all 72787

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>