cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
UserID16644
Level V

Selecting rows with specific data

Hi all,

Is it possible to select something specific in rows? How can it be done? I tried creating a list and incorporate it in Select Rows () but doesn't work. 

 

For example, in column Make, I want to select all the rows with BMW, Hyundai and Nissan.

dt = Open( "$SAMPLE_DATA/Cars.jmp" );

 

What I tried:

rows = {"BMW", "Hyundai", "Nissan"};

dt << Select Rows (rows);

 

It doesn't work. Please help

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Selecting rows with specific data

You can first use << get rows where to get list of interesting rows and then << Select Rows with that list. Or you could use << Select Where directly. Contains() is one option to perform the comparison during selection

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Cars.jmp");

models_to_find = {"BMW", "Hyundai", "Nissan"};

// option1
rows_to_select = dt << get rows where(Contains(models_to_find, :Make));
dt << Select Rows(rows_to_select);

// demo purposes
dt << clear select; // for demo purposes
wait(1);

// option 2
dt << Select Where(Contains(models_to_find, :Make));
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Selecting rows with specific data

You can first use << get rows where to get list of interesting rows and then << Select Rows with that list. Or you could use << Select Where directly. Contains() is one option to perform the comparison during selection

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Cars.jmp");

models_to_find = {"BMW", "Hyundai", "Nissan"};

// option1
rows_to_select = dt << get rows where(Contains(models_to_find, :Make));
dt << Select Rows(rows_to_select);

// demo purposes
dt << clear select; // for demo purposes
wait(1);

// option 2
dt << Select Where(Contains(models_to_find, :Make));
-Jarmo