Thanks, it solved the problem at hand.
But as you quite correctly assumed the next step I have to do is to
identify all diagnose combinations that are there.
Suggestions?
Taavi
David Kantor wrote:
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
--
Tervishoiu instituut
Tartu �likool
Ravila 19
Tartu 50411
GSM: 56663859
Fax: 7374192
e-mail: [email protected]