Hello,
I'm a longtime JMP user, but just recently started learning about scripts. I'm trying to learn the basics, and one of the key things I want to master is the use of for loops.
So I created a sample dataset with 4 columns:
1) PATIENTID: list of unique values for patient number
2) VALUE: Value of a patient rating at a particular timepoint
3) TIME: Timepoint at which patient rating was collected
4) PARAM: The patient rating is divided into 4 items and a total score
I wrote a script to iterate through all of the rows in this data table and to evaluate the values of two different variables (:TIME and :VALUE). If the condition is met, I'd like to add a character value to a row in a new column which is either Yes or No.
Here is the script that I wrote. JMP returns empty values for each of the rows in the new column:
Names Default To Here( 1 );
dt = current data table ();
tr = N Rows (dt);
dt << New Column ("TEST", "CHARACTER",
For (i = 1, i <= tr, i++,
If(
(:TIME == "BASELINE" & :VALUE > 3)
,"YES"
,"NO"
)
)
)
;
This is a simple script, and once I understand the mechanics, would like to add more conditions. But am stuck at this point because the script is not working properly.
I also tried writing this script using the For Each Row function, but still am having the same problem.
Any advice on what I'm doing wrong? Sorry if this is a simple answer, I looked through the documentation and can't seem to figure out what I'm doing wrong.