/*************************************************************************** This code available at: http://pauldickman.com/software/stnet/compare_stns.do Comments available at: http://pauldickman.com/software/stnet/compare_stns/ Compare estimates of net survival (Pohar Perme) between the following user-written Stata commands using the colon cancer data distributed with -strs-.: 1. stnet (https://pauldickman.com/software/stnet/) 2. strs (https://pauldickman.com/software/strs/) 3. stpp (https://pclambert.net/software/stpp/) 4. stns (https://www.stata-journal.com/article.html?article=st0326) Installation of user-written commands ssc install stnet net install https://www.pauldickman.com/strs/strs, all ssc install stpp ssc install stns Paul Dickman, June 2021 ***************************************************************************/ // Modify the life table to include variables required by -stns- use http://pauldickman.com/data/popmort.dta, clear gen double rate_day=rate/365.25 label variable rate_day "Expected mortality rate per day" generate _agedays=_age*365.25 label variable _agedays "Age in days" gen yearindays=mdy(1,1,_year) label variable yearindays "Year as a Stata date (days since 1-1-1960)" sort _year sex _age save popmort_stns, replace use http://pauldickman.com/data/colon.dta if stage==1, clear // stnet requires date of birth generate birthdate=dx-age*365.241 // stnet calculates date of diagnosis as an interger // use this in strs to match replace yydx = 1960 + dx/365.241 stset exit, origin(dx) fail(status==1,2) id(id) scale(365.24) // STNET stnet using popmort_stns, /// breaks(0(.083333333)10) diagdate(dx) birthdate(birthdate) ederer /// list(n d cre2 cns locns upcns secns) listyearly mergeby(_year sex _age) // STRS strs using popmort_stns, /// breaks(0(.083333333)10) mergeby(_year sex _age) notables /// ht pohar list(n d cr_e2 cns_pp lo_cns_pp hi_cns_pp) save(replace) // STPP stpp R_pp using popmort_stns, agediag(age) datediag(dx) /// pmother(sex) list(1(1)10) preserve use grouped, clear list end n d cr_e2 cns_pp lo_cns_pp hi_cns_pp if floor(end)==end restore // STNS generate agediagindays=(dx-birthdate) stset exit, origin(dx) fail(status==1,2) id(id) stns list using popmort_stns, age(agediagindays=_agedays) /// period(dx=yearindays) strata(sex) rate(rate_day) /// at(1(1)10, scalefactor(365.24) method(step))