cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
shasheminassab
Level IV

How to recode column names using jsl?

I need to remove the first word from ALL column names and it can be easily done in the Recode Column Names. However, there is no way to save this task as a script in the recode window. I don't see it in the action recorder of JMP 16 either. Can someone help me with writing the JSL code that can do this job for me?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to recode column names using jsl?

Here is a simple script to do what you want

Names Default To Here( 1 );

dt = Current Data Table();
For( i = 1, i <= N Cols( dt ), i++,
	Column( dt, i ) << set name(
		Trim(
			Substr( Column( dt, i ) << get name, Length( Word( 1, Column( dt, i ) << get name, " " ) ) + 1 )
		)
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to recode column names using jsl?

Here is a simple script to do what you want

Names Default To Here( 1 );

dt = Current Data Table();
For( i = 1, i <= N Cols( dt ), i++,
	Column( dt, i ) << set name(
		Trim(
			Substr( Column( dt, i ) << get name, Length( Word( 1, Column( dt, i ) << get name, " " ) ) + 1 )
		)
	)
);
Jim
shasheminassab
Level IV

Re: How to recode column names using jsl?

Thanks a lot Jim. Helpful as always.