cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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.

Recommended Articles