How to store unique column values as a listI am trying to take a single column from my data table and store each unique value to a list.
Ex:
column is named "Type" and the values in rows 1-6 are "A,B,C,A,B,C"
I currently have:
dtbl = Current Data Table();
newlist = column("Type") <<GETVALUES></GETVALUES>
which returns "A,B,C,A,B,C", but I am trying to get a list which would contain "A,B,C" instead. Any help would be appreciated (I am also new to JSL)
Advanced Statistical ModelingAutomation and ScriptingMass CustomizationQuality and Process EngineeringRe: How to store unique column values as a listHere is one more option using Summary. Getting unique values from :name column
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt_summary = Data Table("Big Class") << Summary(
Group(:name),
Freq("None"),
Weight("None"),
Link to original data table(0),
private
);
uniq_vals = dt_summary[0,1];
Close(dt_summary, no save);
Do note that if you have numeric column and you want to get unique numbers, Summarize will return them as characters and not numbers.
Re: How to store unique column values as a listHere are 2 ways of doing what you want
Names Default To Here( 1 );
dtbl = Current Data Table();
newList = Associative Array( dtbl:type << get values ) << get keys;
or
Names Default To Here( 1 );
dtbl = Current Data Table();
Summarize( dtbl, newlist = by( :Type ) );