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
Heidi
Level II

How to hide and exclude rows based on multiple criteria?

Hi,

I'm new to JSL.  Here is my table. Under same ID and temp I want to exclude rows with higher current. I've been struggled with this and thanks in advance if anyone can help me out...

  ID Temp Current Value
  C 25 35 1.14
  C 55 48 1.43
  C 70 60 1.64
  C 80 65 1.59
  D 25 35 1.18
  D 55 48 1.47
  D 70 60 1.68
  D 80 65 1.64
  E 25 35 1.2
  E 55 48 1.48
  E 70 60 1.65
  E 80 65 1.59
  F 25 35 1.13
  F 55 48 1.36
  F 70 60 1.53
Hide and Exclude F 70 65 1.66
  F 80 65 1.41
Hide and Exclude F 80 70 1.51
2 ACCEPTED SOLUTIONS

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: hide and exclude rows base on multiple criteria

You can do this all interactively in the data table.

 

Start by sorting the data table by ID, Temp and Current.

 

JMPScreenSnapz208.png

 

Then, you can create a new column that looks for repeated ID, Temp combinations and sets an indicator.

 

JMPScreenSnapz209.png

Now you can right click on one of the 1's in the new column and choose Select Matching Values. That will select all the rows that have a 1 in that column. Now you can Hide and Exclude the rows.

JMPScreenSnapz210.png

-Jeff

View solution in original post

Re: hide and exclude rows base on multiple criteria

In JMP 14, you can use the new "Select Duplicate Rows" function interactively or in JSL. 

 

For example, in Big Class to select the weights that are higher under the same sex and height. First sort the table ascending by sex, height, and weight. 

Sort.PNG

 

Highlight the sex and height columns in the datatable. Go to Rows>Row Selection>Select Duplicate Rows. This will select the everything but the first instance of the same sex and height. You can then hide and exclude from there by going to Rows>Hide and Exclude.

Duplicate.PNG

 

You can also script these steps.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Sort(replace table,
	By( :sex,:height,:weight),
	Order( Ascending )
);

dt << Select duplicate rows( Match( :sex, :height ));

dt << hide and exclude (1);

-Olivia

View solution in original post

4 REPLIES 4
gzmorgan0
Super User (Alumni)

Re: hide and exclude rows base on multiple criteria

I am not sure what criteria you want to use, but here is an example

Names Default to Here(1);

dt = Open("$sample_data/Big Class.jmp");

dt << select where(:sex=="F" &  14<=:age<16 & :weight>90);

dt << hide and exclude (1); //use 0 to unexclude and unhide

dt << clear select;
Heidi
Level II

Re: hide and exclude rows base on multiple criteria

Than you. The criteria that I need is not a fixed value. In the data table that I provided, if there are more than one rows with same ID and temp, I want to keep the rows with the lowest current and hide the rest rows with higher current. 

 

do I need a for loop to make this?

Jeff_Perkinson
Community Manager Community Manager

Re: hide and exclude rows base on multiple criteria

You can do this all interactively in the data table.

 

Start by sorting the data table by ID, Temp and Current.

 

JMPScreenSnapz208.png

 

Then, you can create a new column that looks for repeated ID, Temp combinations and sets an indicator.

 

JMPScreenSnapz209.png

Now you can right click on one of the 1's in the new column and choose Select Matching Values. That will select all the rows that have a 1 in that column. Now you can Hide and Exclude the rows.

JMPScreenSnapz210.png

-Jeff

Re: hide and exclude rows base on multiple criteria

In JMP 14, you can use the new "Select Duplicate Rows" function interactively or in JSL. 

 

For example, in Big Class to select the weights that are higher under the same sex and height. First sort the table ascending by sex, height, and weight. 

Sort.PNG

 

Highlight the sex and height columns in the datatable. Go to Rows>Row Selection>Select Duplicate Rows. This will select the everything but the first instance of the same sex and height. You can then hide and exclude from there by going to Rows>Hide and Exclude.

Duplicate.PNG

 

You can also script these steps.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Sort(replace table,
	By( :sex,:height,:weight),
	Order( Ascending )
);

dt << Select duplicate rows( Match( :sex, :height ));

dt << hide and exclude (1);

-Olivia