This maybe gets a bit out of topic and I can create different post to discuss this further...
Even though the documentation is what it is for Set Each Value (JMP documentation isn't always exactly on point...) I feel like it is the easiest way the way to handle cases like this. You can easily use complicated "formulas" with Set Each Value without worrying about removing the formulas later. With Values() the calculations might get a bit more difficult to do, see my example (I'm definitely not proficient with JSL Matrices so there is most likely way easier way to do what I did in my example).
Example with Formulas, Set Each Value and Values:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
//With formulas
newCol = dt << New Column("Formula_simple", Numeric, Continuous, Formula(:height*:weight));
newCol << Delete Formula;
newCol = dt << New Column("Formula_ColMin", Numeric, Continuous, Formula(:height*ColMin(:weight, :sex)));
newCol << Delete Formula;
//With Set Each Value
newCol = dt << New Column("SetEach_simple", Numeric, Continuous, Set Each Value(:height*:weight));
newCol = dt << New Column("SetEach_ColMin", Numeric, Continuous, Set Each Value(:height * ColMin(:weight, :sex)));
//With Values
newCol = dt << New Column("Values_simple", Numeric, Continuous, Values((:height << get values) :* (:weight<< get values)));
newCol = dt << New Column("Values_ColMin", Numeric, Continuous, Values(
Summarize(exg = By(:sex), exm = Min(:weight)); //get min values by group
m_val = J(N Rows(dt),1,1);//matrix for values
height_vec = :height << get values;
For(i = 1, i <= N Items(exg), i++, //loop to "fill" matrix for values
tempRows = Loc(:sex << get as matrix, exg[i]);
m_val[tempRows] = height_vec[tempRows] * exm[i];
);
m_val;
));
What does Set Each Value do behind the scenes because it seems to work just fine? Should the documentation maybe be updated to include this behavior or new function created to do this? It could break quite many scripts people have if Set Each Values behavior were to be changed.
-Jarmo