Announcement

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

  • #16
    I wanted to say I found my problem !
    silly mistake - gender had different lAbel values 1 M 2 F in procedure and the opposite for hospital dataset

    thanks all

    Comment


    • #17
      Denise Vella Your posts are rather difficult to read and follow when you show code all smashed together without line breaks or indentation. Please read the Forum FAQ and pay attention to the advice on how to clearly display both example data and code. (Or follow William Lisowski's excellent examples!)

      In any case, I can see that you did not understand how -rangejoin- works and you are using it incorrectly. When I gave you the example code in #9, I was working on the assumption that the variable called date is the operation date. I made that assumption because it was the only date variable you showed in your example data. But it seems from your attempts to adapt my code that in fact some other, previously unknown and unmentioned, variable OpDate is the actual operation date. That being the case, the command -gen lower = date-1- will give incorrect results because it is using the wrong variable. Try instead:
      Code:
      gen lower = OpDate - 1
      rangejoinn admissiondate lower OpDate using hospital_data_set, by(procedureno gender)
      The variable lower needs to contain the date of the day before the operation date in order to produce correct results.

      Comment

      Working...
      X