06-04-2016 04:47 PM
I have a dataset of 25000 records with this layout;
ID DOC1 DOC2 DOC4 DOC48 Month_death year_death race age gender
1 0 1 0 0 4 2014 1 45 F
DOC1-DOC48 have 0 if the person was on the streets, 1 if incarcerated
DOC1 corresponds to January 2011
DOC48 corresponds to December 2014
Death records are from Jan 2013 to Dec 2014. We only have month and year.
so for this person id #1, she was incarcerated on February 2011 and has been out on the streets since April 2011. I need to count her "street" time as the actual time at risk for dying- DOC1, DOC4-DOC48 -46 months. Need to do this for all records.
I will need to calculate time to death for those that died and time to end of study (Dec 2014) for everyone else for a survival analysis And finally fill-in this table for those that died.
|Number of deaths||Persons-Years at Risk||CMR per 100 person years|
many thanks in advance.
06-04-2016 06:38 PM
What happens if there is no death during the period, how is the date represented? I'm assuming month_death/year_death are numeric.
if month_death ne . then end=mdy(month_death, 1, year_death); else end=mdy(12, 1, 2014); n_months=intck('month', "01Jan2013"d, end); on_street = n_months - sum(of doc1-doc48);
06-05-2016 12:07 AM