Wednesday, February 6, 2013

Matching and linking spell in hospital

I want to identify when 2 spells for a patient stop and start on the same date and then treat these as a single spell in hospital rather than two separate ones. So the intermediate discharge time is dropped and the observed hospital stay is the longer sum of both stays. The problem with how I have codes this at the moment is that for over 600,000 records or episodes this takes about a day to run. There are several loops in the script that I would like to avoid but can't think of a cleverer way to do this.

No comments:

Post a Comment