cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

Delete Duplicate rows

rshehadah
Level II

Hi,

 

I have a datable that I want to delete rows on a duplicate value in a col. 

 

Thank you,

Rami

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User


Re: Delete Duplicate rows

Select Duplicat Rows() function will highlight rows for a specified column(s)

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt <<
Select duplicate rows( Match( :name ) );
xx=dt<<get selected rows;
if(n rows(xx)>0,
	dt<<delete rows;	
);
Jim

View solution in original post


Re: Delete Duplicate rows

Hi Rami,

 

Jim's script is a nice option, but if you have JMP 14 you can also select duplicate rows in a column by point and click.  

Highlight the column of interest, go to the Rows dropdown or red hot spot.  Rows > Row Selection > Select Duplicate Rows.  All of the duplicate values will be highlighted in by row number.  Right click anywhere in the blue region and select delete.  

 

HTH

Bill

View solution in original post

7 REPLIES 7
txnelson
Super User


Re: Delete Duplicate rows

Select Duplicat Rows() function will highlight rows for a specified column(s)

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt <<
Select duplicate rows( Match( :name ) );
xx=dt<<get selected rows;
if(n rows(xx)>0,
	dt<<delete rows;	
);
Jim


Re: Delete Duplicate rows

Hi txnelson!

 

I just wanted to say, I keep seeing your solutions whenever I look up JMP help, and I really appreciate all the work you've done helping people out. You've saved me a ton of time and helped me understand this software better, and it's really appreciated.

 

Thanks!

A happy JMP user


Re: Delete Duplicate rows

Hi Rami,

 

Jim's script is a nice option, but if you have JMP 14 you can also select duplicate rows in a column by point and click.  

Highlight the column of interest, go to the Rows dropdown or red hot spot.  Rows > Row Selection > Select Duplicate Rows.  All of the duplicate values will be highlighted in by row number.  Right click anywhere in the blue region and select delete.  

 

HTH

Bill

lwx228
Level VIII


Re: Delete Duplicate rows

It is recommended that JMP continue to improve to enable all automation with JSL.Thank you very much!

ENTHU
Level IV


Re: Delete Duplicate rows

I have a data table which has column called Part_number.I need to remove duplicate part_numbers.The delete duplicate rows options suggested above deosnt work as in no rows get selected.The column is character,nominal type.I'm using JMP12.

Any other options that I can try?

Also does this function retain the first row and delete the repititions as in Excel?

 

Thanks

 

txnelson
Super User


Re: Delete Duplicate rows

The Select Duplicate Rows() function was not in JMP 12.  The below code should do what you want

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.JMP" );

dt << sort( by( :Part_number ), order( ascending ), Replace Table( 1 ) );
dt << New Column( "dup",
	formula(
		If(
			Row() == 1, value = 1,
			:Part_number != Lag( :Part_number ), value = 1,
			value
			++);
			value;
	)
);

dt << select where( :dup > 1);

dt << delete rows;

dt << delete column( "dup" );
Jim
CanhKhong
Level III


Re: Delete Duplicate rows

Thanks Bill for the tip/trick.

I sometimes have duplicate rows but struggle how to delete them. Just thinking about JMP Community and it helps to solve the issue.