cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

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

How to delete X number of rows from end of each table before concatenating them?

I have a large number of CSV files (with same columns but different number of rows) in a folder and would like to concatenate them all. However, I need to delete 5 rows from end of each table before concatenating them. I would appreciate any help with writing the appropriate JSL code to do this job.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to delete X number of rows from end of each table before concatenating them?

Here is a simple script that will concatenate all open data tables after deleting the last 5 rows in each table.

Names Default To Here( 1 );

tableList = {};

For( i = 1, i <= N Table(), i++,
	Data Table( i ) << delete rows(
		Index( N Rows( Data Table( i ) ) - 4, N Rows( Data Table( i ) ) )
	);
	Insert Into( tableList, Data Table( i ) << get name );
);

dt = New Table( "All Tables" );

For( i = 1, i <= N Items( tableList ), i++,
	dt << concatenate( Data Table( tableList[i] ), append to first table( 1 ) )
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to delete X number of rows from end of each table before concatenating them?

Here is a simple script that will concatenate all open data tables after deleting the last 5 rows in each table.

Names Default To Here( 1 );

tableList = {};

For( i = 1, i <= N Table(), i++,
	Data Table( i ) << delete rows(
		Index( N Rows( Data Table( i ) ) - 4, N Rows( Data Table( i ) ) )
	);
	Insert Into( tableList, Data Table( i ) << get name );
);

dt = New Table( "All Tables" );

For( i = 1, i <= N Items( tableList ), i++,
	dt << concatenate( Data Table( tableList[i] ), append to first table( 1 ) )
);
Jim
shasheminassab
Level IV

Re: How to delete X number of rows from end of each table before concatenating them?

Thanks a lot Jim!!!

Recommended Articles