How can I arrange the unique values obtained from a column in the order they appear in the original column?When looking for unique values in a column, `summarize()` is often used. However, the values outputted by `summarize()` are sorted, and the output in following JSL would look like this: {"64", "67", "74",..., "172"}. I would like the output to be arranged in the order they appear in the column, for example: {"95", "123", "74",...}. What modification should I make to achieve this result?
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
summarize(unique_values=by(weight));
show(unique_values)
Automation and ScriptingRe: How can I arrange the unique values obtained from a column in the order they appear in the original column?This should work.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Duplicate Rows( Match( :weight ) );
dt << Invert Row Selection;
sl = dt << Get Selected Rows;
unique_vals = dt:weight[sl];
Re: How can I arrange the unique values obtained from a column in the order they appear in the original column?You can set the Value Order column property to be Row Order Level

And then when you use Tables=>Summary the new data table will output in the Row Order

Re: How can I arrange the unique values obtained from a column in the order they appear in the original column?Summary table with transform column of row() is one more option (and there are plenty more)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt_summary = dt << Summary(
Group(:weight),
Min(Transform Column("Row", Formula(Row()))),
Freq("None"),
Weight("None"),
statistics column name format("column"),
private
);
dt_summary << Sort(By(:Row), Replace Table, Order(Ascending));
unique = dt_summary[0, 1];
Close(dt_summary, no save);
show(unique);