I used the following command to calculate the overall incidence rate: -stset enddate, failure(diabetes==1) enter(startdate) id(id) scale(365.25)-
enddate = earliest of diabetes diagnosis, death, exit from database or 31st Dec 2019.
startdate = date of first hypertension diagnosis
I now would like to stratify the incidence rate by calendar year and produce a graph with calendar year on the x-axis and incidence rate per 1000 on the y-axis.
I attempted to use the command: -stptime, by (startyear) per(100) dd(2)- where (startyear) is the year hypertension was diagnosed for each id. However, I do not think this is correct.
I have done some reading and come across -stsplit- and -strate-. How would I go about stratifying incidence rate and graph it by calendar year? I've put a dummy example of my data below.
Thank you.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str2 id byte diabetes int(startdate enddate) float survival_time "1" 0 19304 21816 6.877481 "2" 0 20021 20973 2.606434 "3" 0 18497 21796 9.032169 "4" 0 18883 21762 7.882272 "5" 1 20273 21209 2.562628 "6" 0 18868 21803 8.035592 "7" 1 18512 20755 6.140999 "8" 0 19908 20408 1.3689255 "9" 0 19547 20828 3.507187 "10" 0 20409 20983 1.5715264 "11" 1 19643 21817 5.952087 "12" 0 21019 21638 1.6947297 "13" 0 20614 21091 1.3059548 "14" 1 19207 21817 7.145791 "15" 0 20619 21817 3.279945 "16" 1 18517 20078 4.273785 "17" 0 19036 19591 1.519507 "18" 0 19598 20752 3.15948 "19" 1 20988 21628 1.7522244 "20" 0 18713 21816 8.495551 end format %td startdate format %td enddate
0 Response to Crude incidence rate straitfied by calendar year
Post a Comment