Announcement

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

  • Combining time variables

    Hello.

    I'm having trouble combining two variables. My main outcome is looking at time to radiation OR chemotherapy. I have a separate variable for each with time measured in days. I can't simply combine both because there are patients who got both radiation and chemotherapy, so I would need a way to code "time to whichever happens first" in those who got both. Any thoughts?

    Thanks

  • #2
    Sounds like min(time1, time2) to me.

    Comment


    • #3
      Thanks. So to make sure I understand. This means that for each patient who has a value for time1 and time2 use the minimum of both correct? does this exclude patients who only have a value for time1 OR time2?

      Comment


      • #4
        Read -help min()- and you will see that the min() function ignores missing values (unless all variables specified as arguments are missing values), so when time 1 or time 2 is missing, Nick's code gives the non-missing one.

        Comment


        • #5
          No; you can try it and see; also see from the help for min(,) that missings are ignored to the extent possible.

          Comment


          • #6
            This worked. I browsed the combined variable, time1 and time2 and it "min" used the min value if both were present and whichever value of either time1 or time2. Thanks!

            Comment

            Working...
            X