Hello there:
I have a large table (approx 10K rows). I have 3 columns of interest:
- Patient_ID: unique identifier for each patient
- Time: timepoint at which lab sample was collected
- LAB_VALUE: value for the lab parameter with 3 discrete possibilities (NORMAL, MILD, SEVERE)
- SEX: Sex of the patient
I'd like to create a new column called "STATUS" based on the following:
- If Baseline value for Lab_Value = Normal, and at least one post-baseline value is MILD or SEVERE then flag as "1" in STATUS column
- If Baseline value for Lab_Value = Mild, and at least one post-baseline value is SEVERE, then flag as "2" in STATUS column
- If Baseline value for Lab_Value = Severe, and at least one post-baseline value is MILD or NORMAL, then Flag as "3" in STATUS column
This gets a little complicated because some patients drop out before getting all of the labs done. Some patients have data until endpoint (Day 372), and others don't. So it makes it difficult to write a script.
Could you assist in telling me how to do this? I tried to create a bunch of if statements using the formula feature but couldn't get it to work. Any help would be appreciated.
Many thanks