Choose Language Hide Translation Bar
Highlighted
rshehadah
Level I

Delete Duplicate rows

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
Highlighted
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

Highlighted

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

5 REPLIES 5
Highlighted
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

Highlighted

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

Highlighted
lwx228
Level VII

Re: Delete Duplicate rows

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

Highlighted
ENTHU
Level III

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

 

Highlighted
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
Article Labels

    There are no labels assigned to this post.