cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP Wish List

We want to hear your ideas for improving JMP software.

  1. Search: Please search for an existing idea first before submitting a new idea.
  2. Submit: Post your new idea using the Suggest an Idea button. Please submit one actionable idea per post rather than a single post with multiple ideas.
  3. Kudo & Comment Kudo ideas you like, and comment to add to an idea.
  4. Subscribe: Follow the status of ideas you like. Refer to status definitions to understand where an idea is in its lifecycle. (You are automatically subscribed to ideas you've submitted or commented on.)

We consider several factors when looking for what ideas to add to JMP. This includes what will have the greatest benefit to our customers based on scope, needs and current resources. Product ideas help us decide what features to work on next. Additionally, we often look to ideas for inspiration on how to add value to developments already in our pipeline or enhancements to new or existing features.

Choose Language Hide Translation Bar

Operator to set all column names using a list of strings

Hi.  I'm looking for a scripting method to change the column names in my table to names I have contained in a list.  I'm thinking something like: dt << Set Column Names(newcolname_lis)?  This command would change the name of the ith column in the table to the ith item in newcolname_lis, starting at column 1.

 

The reason for this request:

I have tables that can contain >20k columns.  I need to change the column names to merge with the rest of my data tables.  Using a For loop to change the names takes several minutes.  Ideally this could be done using a command in a few seconds.

 

This is a follow up to a question I posted earlier:

https://community.jmp.com/t5/Discussions/Set-column-names-more-efficiently/m-p/311439#M56450 

 

Thanks.

2 Comments
guillaumebugnon
Level V

Hi,

 

I have one function able to rename a column based on string pattern. You can maybe try to adapt it.

 

function_RenameCol = Function({ dt, strpattern, strreplace},
						lstCol	=	dt <<	Get column names( string );
						For( icol = 1, icol <= Nitems(lstCol), icol++,
							if (Contains( lstCol[icol],strpattern) >= 1,
								newname = Munger(lstCol[icol],0,strpattern,strreplace);
								Column( dt, icol ) << Set Name( newname );
							);
						);
					);
Ryan_Gilmore
Community Manager
Status changed to: Archived
We are archiving this request. If this is still important please comment with additional details and we will reopen. Thank you!