cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Ckaiser
Level I

How to store unique column values as a list

I 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();
Show(newlist);

 

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)

 

2 REPLIES 2
txnelson
Super User

Re: How to store unique column values as a list

Here 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 ) );
Jim
jthi
Super User

Re: How to store unique column values as a list

Here 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.

-Jarmo

Recommended Articles