|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Query regarding removing duplicates
Dear Stata people,
In my dataset on hospitalisation data there are people who have been
admitted to Hospital A then transferred (usually within days) to
Hospital B. This appears as two separations or instances of service
for the same person. However, it should only be counted once. The
usual way of dealing with this is to drop all the second instances and
use only the data for the primary admission (apparently).
However, this isn't possible (at this stage) with my dataset.
At discharge, people are discharged "home", "deceased" or "transferred
to another hospital'' etc.
However, at admission, they are sometimes "via ward" but are mostly
"via accident and emergency". All the people who are discharge "to
another hospital" have been readmitted for continuation of care in
Hospital B through "accident and emergency".
Thus, I cannot identify the records for those people being transferred
in, which are the records I want to drop. Unless I can devise some
tricky syntax to do this.
Information that could be useful is the Hospital Record Number (HRN) -
a unique person identifier; the date of admission to Hospital B -
should be the same day or next day to discharge from Hospital A; the
fact that their first record is "discharged to another hospital".
Is there some way of writing code to achieve this:
drop second record if (the person was discharged to another hospital
from the first admission) noting that (the HRN is the same for both
instances) & (date of admission at Hospital B will be same day or next
day to that of admission to Hospital A).
Any ideas will be gratefully received.
Sincerely
Katrina, Australia
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/