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: differentiating between groups of records with same date


From   Tim Evans <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: differentiating between groups of records with same date
Date   Mon, 30 Jul 2012 16:20:15 +0100

Hi all,

I have a group of patients who are in a dataset of cancers. Each patient may have more than one cancer diagnosed, and so may be present in my dataset a number of times. Each patient has a unique patient identifier, and each cancer has a unique cancer identifier. Each row of data is cancer specific, but does contain the patient identifier. It is possible that a patient has 2 cancers diagnosed on the same day in my dataset. What I would like to do is generate a flag next to each record to show against each cancer the number of cancers diagnosed on the same day.

My data are like this:

patient_no		cancer_no	diag_date 	surgery_date 	
9512834		0484360	21may1994	21may1994	
9512834		0484358	21may1994	21may1994		
9512834		0483234	26apr2000	21may2000		
9512834		0483233	26apr2000				
0000057		0000057	19jul2009	19jul2009	
0000060		0000060	02nov2009	24nov2009	
0000074		0000074	21sep2009	22nov2009


For example, patient 9512834 had 2 cancers diagnosed on 21may1994 and so for cancer_no 0484360 and 0484358, I would like to generate a new variable with the value 2 against each record. Similiarly patient 0000057 has only one cancer diagnosed, and so the new variable would contain 1.

Does anyone know what I should do here?

Best wishes

Tim
_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.


*
*   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