Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Equivalent of Excel's COUNTIF


From   "Teubner, David (Health)" <david.teubner@health.sa.gov.au>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Equivalent of Excel's COUNTIF
Date   Wed, 16 Nov 2011 07:17:43 +1030

Apologies for the slightly long-winded first post.

I have a data stet of emergency department presentations for the last 18 years.  The dataset includes numerous variables about individual patient presentations to the department, including time of arrival and time of leaving.  What it does not have is a variable for the number of patients already in the department when each new patient arrives.

It seems to me that I could construct this by simply subtracting the number of patients who have left (prior to the time of arrival of a new patient) from the number who have arrived.  I understand how to calculate the number who have arrived (sort by arrival time and use the _n function) but I don't understand how to do the left number.  In Excel I would use COUNTIF(-all arrival times-,<individual patients discharge time).  Is there a way to do this in Stata?

Thanks in advance

David Teubner
Senior Consultant,Emergency Department
Flinders Medical Centre 
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index