Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: identifying re-operations from a list of operation codes and dates |
Date | Fri, 6 Jul 2012 19:06:15 +0100 |
Paradoxically, or otherwise, there is a lot of detail to absorb here, yet you may be suppressing part of the story to keep it as simple as possible. We lose either way. Assuming that e.g. oper_7 corresponds to operdate_7 then all is not lost. But I would first reshape long oper_ operrate_ , i(id) and then clean up by renaming, dropping missing, sorting on date. But although you named these variables, I fear there are others. (In which variables are the re-operation codes?) I fear that's only a start and you may need to report back. Nick On Fri, Jul 6, 2012 at 3:22 PM, Stephen Martin <stephen.martin@york.ac.uk> wrote: > I have a dataset for patients admitted to hospital. Each record includes: > > a) a patient identifer; > b) 24 four digit operation procedure variables (oper_1 - oper_24; > these are four digit strings such as A148, C169, etc); and > c) 24 date of operation variables (operdate_1 - operdate24). > > Many of the operation procedure code and date variables are empty. > The operation procedure code variables are not necessarily in date > order. > > I have a list (list A) of, say, 20 four digit operation codes that can > identify whether a patient received an operation for the condition in > which I am interested. > > I also have a list (list B) of, say, 35 re-operation codes. > > I would like to identify those patients who had both the operation and > the re-operation. > > However, I cannot solely use lists A and B because some of the same > codes appear in both lists, and a re-operation must occur at least one > day later than the initial operation. > > Thus I would like to identify patients who: > (a) have an operation code from list A > and > (b) have an re-operation code from list B > and > (c) where the date of the re-operation is later than the initial operation. > > Suggestions on how to do this would be very welcome! * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/