|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Loop question
Dear statalisters,
I'm trying to work out how many patients are already present in an emergency
department (a variable called "how_busy") for each member in a list of
patients that includes the variables "arrival datetime" and "discharge
datetime", i.e. I'd like to know how many patients preceding the index
patient have dcdt > current arrdt in a list of visits sorted by arrdt. I'm
no programmer and fairly new to Stata, and haven't been able to make it work
using -forval- and -while- loops with explicit subscripting. Maybe there's a
clever way to do this using -egen-?
An alternative "how_busy" measure might be a count of all patients who were
in the ED during any part of the index patient's visit (maybe it got busy
later). I think this would need to be divided by length of stay. In any case
for me: equally impossible, but maybe this is easy for someone else.
Thanks
Steve Pitts
*
* 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/