Hi everyone, I was hoping someone could help me with the following:
I have a large set of data for patients. One of the fields is for Patient-ID(########), another field is for Case-ID(########), and another field is for Date(DD-MMM-YY).
Each Patient-ID can occur more than once, each Case-ID can occur more than once, and each Date can occur more than once.
I need to create a new field for which the possible values are 1, 2, 3, 4, .... I want the default value in this field to be 1 for each row, and I want the value 2 to be displayed for any entries where the Case-ID for a given Patient-ID is different from the first Case-ID for that Patient-ID. And I want the value 3 to be displayed for any entries where the Case-ID for a given Patient-ID is different from the first and second unique Case-IDs for that Patient-ID.
For example, if for Patient-00384759 I have:
__Patient-ID__|__Case-ID__|__Date__
__00384759__|_00239485_ |_26-Jan-12__
__00384759__|_00239485_ |_13-Feb-12__
__00384759__|_00239485_ |_25-Feb-12__
__00384759__|_01392345_ |_30-Mar-12__
__00384759__|_01392345_ |_09-Apr-12__
__00384759__|_00897273_ |_27-Jun-12__
then I want to create a new field such that the data looks like:
__Patient-ID__|__Case-ID__|___Date____ |__Admission__
__00384759__|_00239485_ |_26-Jan-12__|_____1_____
__00384759__|_00239485_ |_13-Feb-12__|_____1_____
__00384759__|_00239485_ |_25-Feb-12__|_____1_____
__00384759__|_01392345_ |_30-Mar-12__|_____2_____
__00384759__|_01392345_ |_09-Apr-12__|_____2_____
__00384759__|_00897273_ |_27-Jun-12__|_____3_____
Does anyone know how I'd be able to make the code for this new field? Any help is much appreciated!
-Niraj
Bookmarks