Questo è già stato segnalato al supporto JMP e lo hanno inviato come bug allo sviluppo (00049239). Sembra accadere almeno con JMP16.2 e JMP17.0
Proprio come un avvertimento, c'è un bug abbastanza grave con JMP quando si utilizza la combinazione menzionata (imposta ogni funzione statistica di valore, ciclo e colonna). Quello che succede è che JMP utilizza i dati della tabella sbagliata quando aggiunge dati a una tabella diversa. Una soluzione consiste nel fornire la preferenza di tabella all'interno di << Imposta ogni valore (<< Imposta ogni valore (Col Rank (Row(), dt:name))).
Sembra che tu abbia bisogno (basato sui miei test abbastanza veloci):
- Tabelle di dati con gli stessi nomi di colonna
- Passa sopra quelli
- Utilizzare << Imposta ogni valore per impostare i valori nella colonna
- La formula utilizzata dovrebbe utilizzare la funzione statistica Col CON byVar (e molto probabilmente questo deve avere lo stesso nome in entrambe le tabelle)
Di seguito sono riportati alcuni casi di test
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)
));
);
);