[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Loop question

From   "Steve Pitts" <>
To   "StataList" <>
Subject   st: Loop question
Date   Thu, 27 Sep 2007 09:36:36 -0500

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.


Steve Pitts
* For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index