Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Search instead for
Did you mean:
Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
How to Create New Column Based on Values from Two Other Columns?
Oct 3, 2019 4:03 PM(2619 views)
Hello: I'm a long time JMP user, and have just started delving into scripting and use of the formula editor. I have a large table (approx 10K rows). I have several 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.
Thank you, this was so incredibly helpful. I can't thank you enough. Your script worked for me.
I spent the last day trying to figure out how to append to your script. In particular I want to create a 4th category for LAB_VALUE. If a patient's lab value status doesn't meet any of the 3 conditions below, then I'd like to flag it as a fourth category "4".
I tried to add ",4)" to the last if statement, but it wouldn't work. The script editor kept complaining about missing , or ). Or it wouldn't evaluate some of the rows. Any help you can offer would be greatly appreciated.