Re: JMP Script : Creation of a new listIf you have JMP16+ below is one option using Filter Each and checking if column only has missing values with IsMissing
Names Default To Here(1);
input_list = {"height", "Weight", "Age"};
dt = New Table("Untitled 6",
Add Rows(2),
Compress File When Saved(1),
New Column("_LimitsKey", Character, "Nominal", Set Values({"_UCL", "_LCL"})),
New Column("height", Numeric, "Continuous", Format("Best", 12), Set Values([54, 72])),
New Column("Weight", Numeric, "Continuous", Format("Best", 12), Set Values([80, 150])),
New Column("Age", Numeric, "Nominal", Format("", 16), Set Values([., .]))
);
new_list = Filter Each({list_val}, input_list,
found_values = Sum(!IsMissing(dt[0, list_val]));
found_values > 0;
);
show(new_list);
Adding debug prints inside Filter Each might be helpful to understand what is going on. Such as
Show(dt[0, list_val]);
Show(IsMissing(dt[0, list_val]));
Show(!IsMissing(dt[0, list_val]));
show(found_values);
There are also many other ways of doing this (like most of the time with jmp)
Re: JMP Script : Creation of a new listGreat, It is working well! Thaks a lot!
I would like to implement an if condition based on this:
If the Y column is included in the list_val created, then...
How can I write this condition?
If (Eval(Y) <FONT color="#FF0000">!=</FONT> list_val,
...
I think the != is not adapted...
Any idea?
Re: JMP Script : Creation of a new listUse Contains() with If() to check if item is found from a list
Contains({"a","b","c"}, "b");
or you can use Contains Item()
Contains Item("b", {"a","b","c"});Re: JMP Script : Creation of a new listThanks for your reply,
It should work but JMP does not like the Eval(Y) and always return 0:
r=Contains(list_val, Eval(Y))
For information, the Y is made like this:
Y = concat(Y," (ppm)");
Any idea?
Sebastien
Re: JMP Script : Creation of a new listI'm not exactly sure what you are trying to do? Why are you using Eval? Usually it is easier to handle column names as strings and then when you need them convert them to column references in some way
Re: JMP Script : Creation of a new listI am using the Eval because it is based on the user selection and then the concatenation:
Y = concat(Y," (ppm)");
Then I need to determine if this user selection can be found in the list:
r=Contains(list_val, Eval(Y))
I tried this also
r=Contains(list_val, Y)
But also always return 0...
JMP Script : Creation of a new listHello everyone,
I created a list named Y_list containing variable names. From this list, I would like to create a new list, containing only the variable names which contains values in the dataset.
Example:
Y_list contains {"height", "Weight", "Age"}
| _LimitsKey | height | Weight | Age |
| _UCL | 54 | 80 | |
| _LCL | 72 | 150 | |
As there is no value in the Age row, I would like to create a new list containing only variables names which contains data :
Y_new_list ==> {"height", "Weight"}
However, I do not know how to make this new list with JMP script.
Do you have any suggestion to help me?
Thanks a lot
Sebastien
Advanced Statistical ModelingAutomation and Scripting