Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Coding in a washout period

    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

  • #2
    As you don't provide example data, I won't attempt to give you specific code. But the -rangestat- program will probably do this for you. It is written by Robert Picard, Nick Cox, and Roberto Ferrer and you can download it from SSC.

    The code you want will be something like this:

    Code:
    rangestat (count) key_nrd, by(nrd_visitlink) interval(admission_date -30 0)
    where admission_date is to be replaced by whatever variable in your data gives the date of the admission. This will create a new variable key_nrd_count which gives the number of observations for the same patient that occurred within 30 days prior to the admission of the current observation. (You may need to recode missing observations to 0 on this variable.) Then whenever key_nrd_count exceeds 0 you know that the admission occurred within 30 days of some prior admission.

    Comment


    • #3
      That seems to have worked, thanks!

      Comment

      Working...
      X