Dear hive mind,
Working on my dissertation and hit a roadblock. Trying to code in a way to include a washout period between observations to determine whether they can qualify as a new admission/readmission pair.
I was able to figure out how to condition whether the subsequent observation happened within 30 days of the immediate previous, but i also need to determine if it happens within 30 days of any of the prior observations in the group to exclude them.
Data are hospitalizations nested in patients
key_nrd = observation number
nrd_visitlink = patient unique ID
nrd_daystoevent = admission data (serialized)
los = length of stay
/*Generate admission sequence number and total admits per patient for the year*/
by nrd_visitlink: gen admitnum_seq = _n
by nrd_visitlink: gen admitnum_tot = _N
*Generate flag on index admission showing it results in a later readmission, this line flags the 1st observation as resulting
* in a later readmission within 30 days*
sort nrd_visitlink nrd_daystoevent
by nrd_visitlink: gen readmittime_trigger = nrd_daystoevent[_n+1] - (nrd_daystoevent + los)
gen readmit30d_trigger = 0
by nrd_visitlink: replace readmit30d_trigger = 1 if (readmittime_trigger <= 30 & readmittime_trigger>=0) & elective[_n+1]==0
/*Drop cascading readmissions by recoding index admissions back to zero if there
is another admission within 30 days prior to it*/
///this does get rid of cascades, but doesn't account for if 2nd readmission
///within 30d of the first admission in a sequence *FIGURE OUT HOW TO FIX THIS*
gen indexadmit_excl = 0
by nrd_visitlink: replace indexadmit_excl = 1 if (readmittime_result <= 30 & readmittime_result>=0)
Any thoughts on how to code that in would be very helpful, thanks!
Russell
------------------------------------------------------
Russell G. Buhr, MD
Clinical Instructor of Medicine - Division of Pulmonary & Critical Care Medicine
PhD Candidate - Department of Health Policy & Management
Specialty Training in Advanced Research (STAR) Program Fellow
David Geffen School of Medicine & Fielding School of Public Health at UCLA
10833 Le Conte Ave., CHS 37-131
Mail Code 169017
Los Angeles, CA 90095
Working on my dissertation and hit a roadblock. Trying to code in a way to include a washout period between observations to determine whether they can qualify as a new admission/readmission pair.
I was able to figure out how to condition whether the subsequent observation happened within 30 days of the immediate previous, but i also need to determine if it happens within 30 days of any of the prior observations in the group to exclude them.
Data are hospitalizations nested in patients
key_nrd = observation number
nrd_visitlink = patient unique ID
nrd_daystoevent = admission data (serialized)
los = length of stay
/*Generate admission sequence number and total admits per patient for the year*/
by nrd_visitlink: gen admitnum_seq = _n
by nrd_visitlink: gen admitnum_tot = _N
*Generate flag on index admission showing it results in a later readmission, this line flags the 1st observation as resulting
* in a later readmission within 30 days*
sort nrd_visitlink nrd_daystoevent
by nrd_visitlink: gen readmittime_trigger = nrd_daystoevent[_n+1] - (nrd_daystoevent + los)
gen readmit30d_trigger = 0
by nrd_visitlink: replace readmit30d_trigger = 1 if (readmittime_trigger <= 30 & readmittime_trigger>=0) & elective[_n+1]==0
/*Drop cascading readmissions by recoding index admissions back to zero if there
is another admission within 30 days prior to it*/
///this does get rid of cascades, but doesn't account for if 2nd readmission
///within 30d of the first admission in a sequence *FIGURE OUT HOW TO FIX THIS*
gen indexadmit_excl = 0
by nrd_visitlink: replace indexadmit_excl = 1 if (readmittime_result <= 30 & readmittime_result>=0)
Any thoughts on how to code that in would be very helpful, thanks!
Russell
------------------------------------------------------
Russell G. Buhr, MD
Clinical Instructor of Medicine - Division of Pulmonary & Critical Care Medicine
PhD Candidate - Department of Health Policy & Management
Specialty Training in Advanced Research (STAR) Program Fellow
David Geffen School of Medicine & Fielding School of Public Health at UCLA
10833 Le Conte Ave., CHS 37-131
Mail Code 169017
Los Angeles, CA 90095
Comment