Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Programming: Ranking hospitals according to admissions in a dataset with patient level data


From   Andreas Schmid <[email protected]>
To   [email protected]
Subject   st: Programming: Ranking hospitals according to admissions in a dataset with patient level data
Date   Mon, 19 Jul 2010 16:56:32 +0200

Dear Statalist users,

I am working with a patient dataset which contains information on each admitted patient as well as on the according hospitals. For further steps I need a rank number for each hospital according to admissions per year. The variable "admissions" already exists. As for each hospital there are a couple of thousand observations (i.e. patients), I can not just use egen ranking = rank(admissions), as this would try to rank each individual observation.

Is there any way to generate a variable ranking that gives in each observation the same rank for one particular hospital?

Example:
Hospital A has got 5000 admissions per year and is thus the second largest hospital according to admissions. Thus, for any patient admitted to hospital a the variable ranking shows "2".

Structure:
Hospital-ID Admissions Sex Age | RANKING
A 5000 male 15 | 2
A 5000 female 56 | 2
B 3000 male 60 | 6
A 5000 male 70 | 2
B 3000 male 71 | 6
...
...
...

Thanks a lot for your help!

Andreas

--
Andreas Schmid
University of Bayreuth
Germany
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index