Statalist The Stata Listserver

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

st: more complicated counting...

From   "Moore, Jesse" <>
To   <>
Subject   st: more complicated counting...
Date   Wed, 16 May 2007 10:13:34 -0400

I have data about surgeons who were operated on at different hospitals.
I'd like to keep the information from the hospital with the most cases:
Patient	Surgeon	Hosp	Cases@hosp	NumofHosp
A		A		1	4		1
B		A		1	4		1
C		A		1	4		1
D		A		1	4		1
E		B		1	2		2
F		B		1	2		2
G		B		2	1		2

I've used gsort so Cases@hosp is in descending order.  I'd like to have
a way of creating a new var (keepers) that would identify patients A-F
but not patient G (second hospital for the surgeon and the hospital with
the fewest cases for that surgeon).  Or, put another way, if the Hosp
changes for a surgeon the indicator var "keepers" goes from a 0 to 1 and
stays that way until the next surgeon.  

I realize there are a lot of programs out there (SSC).  How does one go
about searching them for a possible solution to programming challenges?



Jesse Moore, MD
General Surgery Resident
Fletcher Allen Healthcare
University of Vermont

Confidentiality Notice:
This message, and any attachments, may contain information that is confidential, privileged, and/or protected from disclosure under state and federal laws that deal with the privacy and security of medical information. If you received this message in error or through inappropriate means, please reply to this message to notify the Sender that the message was received by you in error, and then permanently delete this message from all storage media, without forwarding or retaining a copy.

*   For searches and help try:

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