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
UserID16644
Level V

How to replace specific words in multiple column names?

Hi all,

 

Is it possible to replace the column names which contains a specific word? For example, my column names are Name, Age, New_Address, New_School, New_Number. And I need to replace the word New with Current or columns that may contain the word New ---- my new column names will become Name, Age, Current_Address, Current_School, Current_Number. TIA

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to replace specific words in multiple column names?

Here is one way to do it

Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column names( string );

For Each( {col}, colNames,
	If( Contains( col, "New" ),
		Column( dt, col ) << set name( Substitute( col, "New", "Current" ) )
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to replace specific words in multiple column names?

Here is one way to do it

Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column names( string );

For Each( {col}, colNames,
	If( Contains( col, "New" ),
		Column( dt, col ) << set name( Substitute( col, "New", "Current" ) )
	)
);
Jim
jthi
Super User

Re: How to replace specific words in multiple column names?

You can also use Recode Column Names for this.

jthi_0-1725514259824.png

jthi_1-1725514271659.png

jthi_2-1725514286248.png

jthi_3-1725514292965.png

 

-Jarmo

Recommended Articles