12-31-2012 12:03 PM
I have a dataset with variables as follows:
Patient_id = unique patient number
Facility_id = unique clinic number
TEMPORARY_ABSENCE_DATE = date of hospital admission
TEMPORARY_ABSENCE_END_DATE = date of hospital discharge
diagnosis_code = ICD-9 code for hospitalization
diagnosis_description = translation of ICD-9 code to text
hosp_days = number of days in the hospital
For each patient(at each specific clinic) I am trying to determine the number of readmissions within 30 days - In my first method I need to determine the admissions that occur within 30 days of prior discharge and have no following discharge. I also need to determine admissions that occurred within 30 days of prior admission and have another admission within 30 days. I can determine the number of days between each discharge and the number of admissions for each patient, but beyond that I am lost as to how to write a program that can determine if there are following admissions and if so how far in time those admissions took place (within 30 days or not). Hopefully this question makes sense, if not I can add more info. Although I do not have much more info to give...
12-31-2012 01:22 PM
Here's an example of a solution that was posted a while ago, it should be fairly close to what you're looking for.
12-31-2012 02:19 PM
My main problem is determining if the patient has been admitted previously (within less than 30 days from the index date). The index date in this case is an admission from which we count readmissons within 30 days (first admission during the period or no prior admission within 30 days). So, I have created a variable with the days since last disharge but I am confused how to use that variable to determine the admissions that occur within 30 days of prior discharge and have no following discharge. For example lets say there is a person who has been admitted on 6/20/2008 -6/22/2008, 8/23/2008 - 8/25/2008, 9/1/2008- 9/3/2008, and 9/20/2008-9/27/2008. The first and second admissions in this case are index admissions. I want to assign the 4th observation a readmission only status because its an admission that occurs within 30 days of prior discharge and has no following admissions. The issue is how do determine that in SAS.
12-31-2012 03:47 PM
I don't see the problem, once you've created the lag you can use a second datastep to actually determine what's an 'index' visit.
It will be one that isn't classified as a readmission and/or your first visit.
You can use first.facility_id assuming you're sorting and classifying according to patient/facility.
Give it a start and post the code you have if you need more help.
12-31-2012 04:24 PM
How do I say that someone's third (or fourth or fifth, etc) admission is one that should be flagged but not their others? Like in the example above if there were a fifth admission over 30 days away from the last I'd still want to flag the fourth admission.
This is what I have so far:
patientid_center = catt( of patient_id facility_id);
proc sort data = mergecounts; by patientid_center; run;
data firstlast; set mergecounts;
first = first.patientid_center;
last = last.patientid_center;
if first.patientid_center then count = 0;
lagdate = lag(TEMPORARY_ABSENCE_END_DATE);
if first.patientid_center ne 1 then DAYS_SINCE_LAST_DISCHARGE = TEMPORARY_ABSENCE_DATE - laggeddate ;
if DAYS_SINCE_LAST_DISCHARGE > 30 or first = 1 then index = 1;
format laggeddate mmddyy10. admit2 mmddyy10.;
12-31-2012 04:35 PM
The code looks fine to me, but I'm assuming it doesn't work somewhere?
Can you post an example of the situation where it doesn't work, where you're not capturing your index=1 basically.
12-31-2012 04:56 PM
It works but doesnt answer my question, I need a second variable labeling the less than 30 day readmissions that occur without other admissions following them and I cannot figure out how to do that part.
12-31-2012 05:19 PM
12-31-2012 05:48 PM
You can create a readmission variable using the lagged duration, this will show which visits are readmissions.
i.e. readmission= (DAYS_SINCE_LAST_DISCHARGE <= 30);
I'm not sure what you mean by ' less than 30 day readmissions that occur without other admissions following them' so I can't comment on that but with the index and readmission I'm sure its possible.