cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to design an experiment, explore factor-response relationships, assess tradeoffs, and ID best settings. Register for Sep. 11 Mastering JMP.

Discussions

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

JSL Column Name Search and Replace

I have lot of column name and I want to rename my column name as below. How can I use Set name to replace all my columns in the table?

 

NAME [US] 1999 AMERICA POP US123 -> AMERICA US123 
NAME [US] 1999 AMERICA POP US456 -> AMERICA US456 
NAME [US] 1999 AMERICA POP US145 -> AMERICA US145

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:Age << Set Name( "Time" );

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL Column Name Search and Replace

I think this should work, or at least it is close to it.

Names Default To Here( 1 );
dt = Current Data Table();

colList = dt << get column names( string );

For( i = 1, i <= N Items( colList ), i++,
	If( Left( colList[i], 14 ) == "NAME [US] 1999",
		Column( dt, colList[i] ) << set name( "AMERICA " || 
			Word( -1, colList[i], " " ) )
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: JSL Column Name Search and Replace

I think this should work, or at least it is close to it.

Names Default To Here( 1 );
dt = Current Data Table();

colList = dt << get column names( string );

For( i = 1, i <= N Items( colList ), i++,
	If( Left( colList[i], 14 ) == "NAME [US] 1999",
		Column( dt, colList[i] ) << set name( "AMERICA " || 
			Word( -1, colList[i], " " ) )
	)
);
Jim
sam_t
Level III

Re: JSL Column Name Search and Replace

Works like a charm. Thank you!

Recommended Articles