To Taavi Lai:
There are several way of doing this. Here's one.
Say you have a variable called diag for diagnosis, and suppose that you are
looking for persons that have the combination of values 2,3 & 7. (Those
may not be realistic diag values, but they will suffice for now.) Also
suppose that you have personid to identify persons.
sort personid
egen byte hasdiag2 = max(diag==2), by(personid)
egen byte hasdiag3 = max(diag==3), by(personid)
egen byte hasdiag7 = max(diag==7), by(personid)
/* (And you could compact that sequence with a -foreach- if you prefer.) */
gen byte hascombination = hasdiag2 & hasdiag3 & hasdiag7
/* You could also ...
bysort personid: keep if _n==1
-- if you want to reduce to one observation per person.
(And it could go before the -gen byte hascombination-.)
*/
----
This detects that the person has at least the particular combination; it
does not detect whether these are the ONLY diagnoses. You were not clear
whether that was part of the problem. If it is, then
more needs to be done.
I hope this is helpful.
-- David
At 11:42 PM 2/4/2005 +0200, Taavi Lai wrote:
Could someone point me a way:
I have a list of people and their diagnoses. One person can have varying
number of observations according to the number of diagnoses.
I need to identify people with specific combination of diagnoses.
Taavi Lai
David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404
*
* 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/