Announcement

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

  • Hospital readmissions

    Dear Statalist

    Many thanks in advance for your help. I am stuck in a situation where I need to calculate hospital readmissions and check if they are for the same reason. I was able to calculate the re-admissions using, "by id (admission_date), sort: gen is_readmission_90 = admission_date-admission_date[_n-1] <=90". However, I cannot calculate if these were for the same reason. For the reasons, I have a string variable with codes like"S799", "H358", etc. So, for all the readmissions with a timeframe, I need to check how many were for the same reason. Can you please help?
    Many thanks and regards
    Vishal

  • #2
    maybe something along the lines of,
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte id int admission_date str1 reason
    1 20000 "A"
    1 20010 "B"
    1 20050 "B"
    1 20090 "C"
    1 20110 "D"
    1 20120 "A"
    1 20130 "C"
    1 20140 "C"
    end
    
    by id reason (admission_date), sort: gen readmission = admission_date <= admission_date[1] + 90 if _n>1
    collapse (sum) readmission, by(id reason)
    
    list, ab(16)
    
         +---------------------------+
         | id   reason   readmission |
         |---------------------------|
      1. |  1        A             0 |
      2. |  1        B             1 |
      3. |  1        C             2 |
      4. |  1        D             0 |
         +---------------------------+
    Last edited by Øyvind Snilsberg; 08 Feb 2022, 02:08.

    Comment


    • #3
      Many thanks for your help. Much appreciated.

      Comment

      Working...
      X