Esto ya se informó al soporte de JMP y lo enviaron como un error al desarrollo (00049239). Parece que sucede al menos con JMP16.2 y JMP17.0
Solo como un aviso, hay un error bastante malo con JMP cuando se usa la combinación mencionada (establecer cada valor, bucle y funciones estadísticas de col). Lo que sucede es que JMP usa datos de una tabla incorrecta al agregar datos a una tabla diferente. Una solución es proporcionar preferencia de tabla dentro de << Establecer cada valor (<< Establecer cada valor (Clasificación de columna (Fila(), dt: nombre))).
Parece que necesita (basado en mis pruebas bastante rápidas):
- Tablas de datos con los mismos nombres de columna
- Bucle sobre esos
- Use << Establecer cada valor para establecer valores en la columna
- La fórmula utilizada debe utilizar la función estadística Col CON byVar (y lo más probable es que tenga el mismo nombre en ambas tablas)
A continuación se muestran algunos casos de prueba.
Names Default To Here(1);
// https://www.jmp.com/support/help/en/17.0/#page/jmp/scoping-operators.shtml#
// Initialize data
test_tables = {};
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column("REAL NAME RANK", Numeric, Continuous, Formula(Col Rank(Row(), :NAME)));
Column(dt, "age") << Set Modeling Type("Continuous");
Insert Into(test_tables, dt);
dt = Open("$SAMPLE_DATA/Students1.jmp");
dt << Sort(By(:name), Replace Table, Order(Ascending)); // sort to create worse scenario
dt << New Column("REAL NAME RANK", Numeric, Continuous, Formula(Col Rank(Row(), :NAME)));
Column(dt, "age") << Set Modeling Type("Continuous");
Insert Into(test_tables, dt);
/*
dt = Open("$SAMPLE_DATA/Students2.jmp");
dt << Sort(By(:name), Replace Table, Order(Ascending)); // sort to create worse scenario
dt << New Column("REAL NAME RANK", Numeric, Continuous, Formula(Col Rank(Row(), :NAME)));
Column(dt, "age") << Set Modeling Type("Continuous");
Insert Into(test_tables, dt);
*/
// use idx 1 to skip first table
min_idx = 0;
// without reversing we will run out of index as we are using wrong table
// but if we reverse we will get worse outcome (in my opinion) as we end up with wrong data
reverse_tableorder = 0;
If(reverse_tableorder,
test_tables = Reverse(test_tables);
);
For Each({dt, idx}, test_tables,
// works
// dt << New Column("COPY", Character, Nominal, << Set Each Value(:NAME));
// dt << New Column("MULTI", Numeric, Continuous, << Set Each Value(:age * :age));
If(idx > 0, // if the column isn't created to first table seems to work fine?
// Doesn't work (// old table used due to some col function optimizations when using byVar?)
Try(
dt << New Column("RANK", Numeric, Continuous, << Set Each Value(Col Rank(Row(), :NAME)));
,
show(exception_msg);
);
Try(
new_col = dt << New Column("RANK_SEPARATE", Numeric, Continuous);
new_col << Set Each Value(Col Rank(:Row(), :name));
,
show(exception_msg);
);
Try(
new_col = dt << New Column("SUM", Numeric, Continuous, << Set Each Value(Col Sum(1)));
,
show(exception_msg);
);
Try(
new_col = dt << New Column("SUM_WITH_GROUP", Numeric, Continuous, << Set Each Value(Col Sum(1, :name)));
,
show(exception_msg);
);
Try( // with reverse_tableorder = 1, :age is taken from correct table BUT the group sizes from wrong?
// KATIE -> 72 (6*12) and not 11+12+12+13+14+15 -> 77
new_col = dt << New Column("SUM_OF_COL", Numeric, Continuous);
new_col << Set Each Value(Col Sum(:age, :name));
,
show(exception_msg);
);
// workaround
dt << New Column("RANK_WITH_REF", Numeric, Continuous, << Set Each Value(
Col Rank(Row(), dt:NAME)
));
);
);