BookmarkSubscribeRSS Feed
malena
Calcite | Level 5

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
1 month      
3 months      
6 months      
1 year      
2 year      
All deaths      

 

 

many thanks in advance.

 

 

 

 

 

 

2 REPLIES 2
Reeza
Super User

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);
malena
Calcite | Level 5
Thanks Reeza, if there are no deaths, then the end of the study period is December 2014. And yes these are numeric

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2295 views
  • 0 likes
  • 2 in conversation