<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: rename column names in a jmp file as per values in rows in a separate .csv file in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345213#M59547</link>
    <description>&lt;OL&gt;
&lt;LI&gt;You indicate that my last code isn't working.....why not?&lt;/LI&gt;
&lt;LI&gt;Here is a way to create the list that you are asking for
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Category_List = {};
For( i=1, i&amp;lt;= N Rows( dtCat ), i++,
     insert into(Category_List, word(3,:data[i],".") || "." || word(4,:data[i], "." )  );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Sun, 03 Jan 2021 05:05:31 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-01-03T05:05:31Z</dc:date>
    <item>
      <title>rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345121#M59531</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am newbie to JSL, so appreciate help.&lt;BR /&gt;I have three files.&lt;/P&gt;&lt;P&gt;file #1: It is the Reference file, [as ref.csv] holding 3 cols as below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Category, width, label&lt;BR /&gt;--------------------------------&lt;BR /&gt;A,0,L1.abc&lt;BR /&gt;A,1,L2.xt&lt;BR /&gt;A,2,L8.dr&lt;BR /&gt;A,3,L20.ws&lt;BR /&gt;A,4,L72.oz&lt;BR /&gt;B,0,L11.qq&lt;BR /&gt;....&lt;BR /&gt;B,6,L61.er&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file #2: data file#1 in JMP, holding Category, Data and many other cols.&lt;BR /&gt;file #3: data file #2 in JMP, holding Category, Data and many other cols.&lt;BR /&gt;difference between the two data files [File #2 and file #3] is the category type and width of value in data col.&lt;/P&gt;&lt;P&gt;Data file #1:&lt;/P&gt;&lt;P&gt;Category|data|many cols.....&lt;BR /&gt;----------------------------------------&lt;BR /&gt;A 123.23 ....&lt;BR /&gt;A 321.45 ....&amp;nbsp;&lt;BR /&gt;.....&lt;BR /&gt;many rows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the width of values in the column "data" [excluding the dots] is matching to the # of rows in file #1 for a given category&lt;BR /&gt;example:&lt;BR /&gt;width of 123.23 in row 1 in data file#1 is 5.&lt;BR /&gt;the # of rows in reference file for category A would be 5. this need not be tested per say. this is how the tables are coming in [ie when pulled from the source]&lt;/P&gt;&lt;P&gt;In the future, in the reference file , say for category A , the # of rows increase to 6 or more, the width of the value held in the data column in file data file #1 would also increase when information is pulled from database.&lt;/P&gt;&lt;P&gt;Data file #2:&lt;/P&gt;&lt;P&gt;Category|data|many cols.....&lt;/P&gt;&lt;P&gt;----------------------------------------&lt;BR /&gt;B 1236.23 ....&lt;BR /&gt;B 3213.45 ....&amp;nbsp;&lt;BR /&gt;.....&lt;BR /&gt;many rows&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Goal 1:create new cols dependent on the width of value held in the "data" col in the datafile #1 [and other data files]&lt;BR /&gt;I am done with goal # 1 !&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ex:&lt;BR /&gt;updated data file#1 would look like this:&lt;BR /&gt;Category|data|c1|c2|c3|c4|c5|many cols.....&lt;BR /&gt;----------------------------------------&lt;BR /&gt;A 123.23 1 2 3 2 3 ....&lt;BR /&gt;A 321.45 3 2 1 4 5 ....&amp;nbsp;&lt;BR /&gt;.....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;goal 2: rename the new cols in data file #1 [ie c1 to c5] to L1... to L72... as defined in the column "label" in the reference file. no change in the cells values, just update the selected col names.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;expected output after goal 2 is done:&lt;BR /&gt;Update the data file #1 to look like this:&lt;BR /&gt;Category|data|L1.abc|L2.xt|L8.dr|L20.ws|L72.oz|many cols.....&lt;BR /&gt;----------------------------------------&lt;BR /&gt;A 123.23 1 2 3 2 3 ....&lt;BR /&gt;A 321.45 3 2 1 4 5 ....&amp;nbsp;&lt;BR /&gt;.....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I need help with goal #2.&lt;/P&gt;&lt;P&gt;For goal #2 I opened the reference file but not sure to move forward.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;David&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:24:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345121#M59531</guid>
      <dc:creator>david_sam</dc:creator>
      <dc:date>2023-06-10T23:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345159#M59533</link>
      <description>&lt;P&gt;Here is an untested Script, that should be pretty close to being able to meet your second goal&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtCat = Data Table( "file#1 name" );
dt1 = Data Table( "file#2 name" );
dt2 = Data Table( " file#3 name" );
// add dt3, dt4 etc. for each of the categories you have

// Find the number of data tables to process....A B C......
// Create a temporary new column in data table dtCat that has just the category
dtCat &amp;lt;&amp;lt; New Column( "temp", character, formula( Word( 1, :data, "." ) ) );
// Summarize the data getting one element in the ByGroup list for each Category found
Summarize( dt, Categories = ByGroup( :temp ) );
numCategories = N Items( Categories );

For( i = 1, i &amp;lt;= numCategories, i++, 
	// Subset the dtCat table into the a new data table with just the one
	// category being processed
	dtCat &amp;lt;&amp;lt; select where( :temp == Categories[i] );
	dtSub = dtCat &amp;lt;&amp;lt; subset( selected rows == 1, selected columns( 0 ) );
	
	// set the offset of where to start the renaming
	offset = 3;
	
	// Loop
	// Change names in dt1 to match the Label in 
	For( k = 1, k &amp;lt;= N Rows( dtSub ), k++,
		Eval(
			Substitute(
					Expr(
						Column( __dt__, k + offset ) &amp;lt;&amp;lt; set name( Word( 3, dtSub:Data[k], "." ) ),
						Expr( __dt__ ),
						Parse( "dt" || Char( i ) )
					)
			)
		)
	);
	
	Close( dtSub, nosave );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Jan 2021 20:37:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345159#M59533</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-01T20:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345211#M59545</link>
      <description>&lt;P&gt;Thanks Jim.&amp;nbsp;It is not working.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for goal #2,I have broken down the whole logic into values steps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;step1: get the category names from data table [say dt1] and store it in a variable [say it is holding category of A]-&amp;nbsp; DONE&lt;/P&gt;&lt;P&gt;step2: read variable from step1 and find all the rows that match category = A] get label names from the column "Label" from the ref.csv, [which you have called as dtCat], and store it in a list or variable.[ say it called category_list]&lt;/P&gt;&lt;P&gt;so using from the example stated in the discussion. I am expecting category_list to hold below values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;category_list =&amp;nbsp;&lt;SPAN&gt;L1.abc,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;L2.xt,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;L8.dr,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;L20.ws,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;L72.oz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I dont know how to do this. Appreciate help.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;step 3: Check the count in list == no. of new cols created in the dt1. this is extra thing I am doing for robustness.&lt;/P&gt;&lt;P&gt;count in&amp;nbsp;category_list is 5 elements&lt;/P&gt;&lt;P&gt;new cols created in dt1 is 5. [&amp;nbsp;I got this from goal 1 as I am holding a variable to find how many new cols are needed].&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step 4: replace the cols names in dt1 , ie c[i] with list [i] using loop where i = 5&amp;nbsp;&lt;/P&gt;&lt;P&gt;c1 replaced&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am right now in step 2 and need some help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 02:13:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345211#M59545</guid>
      <dc:creator>david_sam</dc:creator>
      <dc:date>2021-01-03T02:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345213#M59547</link>
      <description>&lt;OL&gt;
&lt;LI&gt;You indicate that my last code isn't working.....why not?&lt;/LI&gt;
&lt;LI&gt;Here is a way to create the list that you are asking for
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Category_List = {};
For( i=1, i&amp;lt;= N Rows( dtCat ), i++,
     insert into(Category_List, word(3,:data[i],".") || "." || word(4,:data[i], "." )  );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Sun, 03 Jan 2021 05:05:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345213#M59547</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-03T05:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345214#M59548</link>
      <description>&lt;P&gt;I looked at the code you have provided.. There seems to be some confusion.&lt;/P&gt;&lt;P&gt;this is how I intercepted and correct me it is wrong.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dtcat is the reference table with col name [&lt;SPAN&gt;Category, width, label].&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;there multiple data tables dt1,dt2 etc with same structure with col names [Category|data|many cols.....]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;when I run the code, it does nothing&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;there is no column named data in dtcat table and looked into the debug.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;May be you meant dt1 table as it is data column.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried playing around and it would not help.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think we are align on the definitions on the table , use what I have described in the original post, I might help in my opinion.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Again appreciate the help here.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me the recommendation for step 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 05:30:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345214#M59548</guid>
      <dc:creator>david_sam</dc:creator>
      <dc:date>2021-01-03T05:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345215#M59549</link>
      <description>&lt;P&gt;Jim,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For step 2 with below modifications [shown below]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;++++&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my ref.csv :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;category|width|label&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ABC 0 label0.0&lt;BR /&gt;ABC 1 label0.1&lt;BR /&gt;ABC 2 label0.2&lt;BR /&gt;ABC 3 label0.3&lt;BR /&gt;ABC 4 label0.4&lt;BR /&gt;ABC 5 label0.5&lt;BR /&gt;ABC 6 label0.6&lt;BR /&gt;ABC 7 label0.7&lt;BR /&gt;ABC 8 label0.8&lt;BR /&gt;ABC 9 label0.9&lt;BR /&gt;ABC 10 label0.10&lt;BR /&gt;ABC 11 label0.11&lt;BR /&gt;ABC 12 label0.12&lt;BR /&gt;ABC 13 label0.13&lt;BR /&gt;ABC 14 label0.14&lt;BR /&gt;ABC 15 label1.15&lt;BR /&gt;ABC 16 label0.16&lt;BR /&gt;ABC 17 label0.17&lt;BR /&gt;ABC 18 label0.18&lt;BR /&gt;ABC 19 label0.19&lt;BR /&gt;ABC 20 label0.20&lt;BR /&gt;B 0 label11.22&lt;BR /&gt;C 1 label11.21&lt;BR /&gt;D 2 label11.23&lt;BR /&gt;E 0 label11.24&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;P&gt;dt_ref = Open ("ref.csv");&lt;/P&gt;&lt;P&gt;For( i=1, i&amp;lt;= N Rows( dt_ref ), i++,&lt;BR /&gt;insert into(Category_List, word(1,:label[i],".") || "." || word(2,:label[i], "." ) );&lt;BR /&gt;);&lt;BR /&gt;show(Category_List);&lt;/P&gt;&lt;P&gt;+++&lt;/P&gt;&lt;P&gt;I am getting the following&amp;nbsp;on the log:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Category_List = {"label0.0", "label0.1", "label0.2", "label0.3", "label0.4", "label0.5", "label0.6", "label0.7", "label0.8", "label0.9", "label0.10", "label0.11", "label0.12", "label0.13", "label0.14", "label1.15", "label0.16", "label0.17", "label0.18", "label0.19", "label0.20", "label11.22", "label11.21", "label11.23", "label11.24", ".", "."};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want it to select the labels only when category is ABC. how do I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the following but it is returned nothing for the Category_List:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;prod_found ={"ABC"};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (:product == prod_found,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; For( i=1, i&amp;lt;= N Rows( dt_ref ), i++,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; insert into(Category_List, word(1,:name[i],".") || "." || word(2,:name[i], "." ) );&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;);&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 06:12:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345215#M59549</guid>
      <dc:creator>david_sam</dc:creator>
      <dc:date>2021-01-03T06:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345220#M59551</link>
      <description>&lt;P&gt;Sorry for my misinformation.&amp;nbsp; I misread the structure of the Categories data table.&amp;nbsp; Below is a script that creates a couple of data tables, and a categories table and then expands the data tables and finally renames the columns based upon the entries in the categories data table.&amp;nbsp; I hope this gets us back on track.&amp;nbsp; The script will work on as many data tables as necessary.&amp;nbsp; All that has to be done, is to add to the dataTableList list, all of the data tables to be processed&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// This example script opens up 2 data tables and 1 category table.  
// In reality, as many as necessary data tables could be used

// Create the tables
dt1 = New Table( "Table1",
	Add Rows( 3 ),
	New Column( "Category", Character, "Nominal", Set Values( {"ABC", "ABC", "ABC"} ) ),
	New Column( "DATA", Character( 33 ), "Nominal", Set Values( {"123.56.8.342", "431.02.0.567", "318.00.1.816"} ), Set Display Width( 182 ) )
);
dt2 = New Table( "Table2",
	Add Rows( 3 ),
	New Column( "Category", Character, "Nominal", Set Values( {"B", "B", "B"} ) ),
	New Column( "Data", Character, "Nominal", Set Values( {"13.24", "98.44", "63.89"} ) )
);
dtCat = New Table( "The Categories",
	Add Rows( 13 ),
	New Column( "Category",
		Character,
		"Nominal",
		Set Values( {"ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "B", "B", "B", "B"} ),
		Set Display Width( 67 )
	),
	New Column( "Width", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3] ) ),
	New Column( "Label",
		Character( 16 ),
		"Nominal",
		Set Values(
			{"label0.0", "label0.1", "label0.2", "label0.3", "label0.4", "label0.5", "label0.6", "label0.7", "label0.8", "thelabel.1", "thelabel.2",
			"thelabel.3", "thelabel.4"}
		),
		Set Display Width( 99 )
	)
);

// Below this line, is the script that will add the new columns to each of the data tables
// and will take the names from the dtCat (Categories) data table and change the names to
// the columns in each of the data tables

// Create a list of the pointers to the data tables.  This will allow for the using of the list 
// entries to point to the data tables using a subscript 
dataTableList = {};
insert into(dataTableList, dt1 );
insert into(dataTableList, dt2 );

// Loop across the data table list and expand the columns based upon the the column called Data
For( i = 1, i &amp;lt;= N Items( dataTableList ), i++,
	ncols_to_add = length( substitute((dataTableList[i]:Data)[1],".",""));
	For( k = 1, k &amp;lt;= ncols_to_add, k++, // the || operator joins two strings
		dataTableList[i] &amp;lt;&amp;lt; New Column( "c" || Char( i ),
			Numeric,
			Continous,
			&amp;lt;&amp;lt;Set Each Value( Num( Substr( Regex( :data, "\D", "", GLOBALREPLACE ), k, 1 ) ) )
		)
	)
);

// Now rename the columns in each of the data tables based upon the labels in the Category table

For( i = 1, i &amp;lt;= N Items( dataTableList ), i++, 
	// Subset the dtCat table into the a new data table with just the one
	// category being processed
	dtCat &amp;lt;&amp;lt; select where( :Category == (dataTableList[i]:Category)[1] );
	dtSub = dtCat &amp;lt;&amp;lt; subset( selected rows == 1, selected columns( 0 ) );
	
	// set the offset of where to start the renaming
	offset = 2;
	
	// Loop
	// Change names in dt1 to match the Label in 
	For( k = 1, k &amp;lt;= N Rows( dtSub ), k++,
		Column( dataTableList[i], k + offset ) &amp;lt;&amp;lt; set name( dtSub:Label[k] )
	);
	
	Close( dtSub, nosave );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 Jan 2021 10:32:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345220#M59551</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-03T10:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345245#M59557</link>
      <description>&lt;P&gt;Thanks Jim. With minor changes [to my needs] it works ! Thank you !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question, can the list [datatableList] hold lot of info?&lt;/P&gt;&lt;P&gt;Each of my tables has lots of rows like in thousands and has many cols also.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 18:52:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345245#M59557</guid>
      <dc:creator>david_sam</dc:creator>
      <dc:date>2021-01-03T18:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345248#M59559</link>
      <description>&lt;P&gt;dataTableList does not hold the data tables, it only holds pointers to the tables. Create the list and then run&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Show( dataTableList );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and you will see what is in the list.&lt;BR /&gt;You can also see what is in the list, by just hovering your mouse over the variable, and it will display it's value&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 21:01:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345248#M59559</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-03T21:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345249#M59560</link>
      <description>&lt;P&gt;yup. got it. holds the name of the data table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-David&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jan 2021 19:20:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345249#M59560</guid>
      <dc:creator>david_sam</dc:creator>
      <dc:date>2021-01-03T19:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: rename column names in a jmp file as per values in rows in a separate .csv file</title>
      <link>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345254#M59564</link>
      <description>OK.....this is a bit picky.....but what is in the dataTablesList are not a list of data table names but data table() functions, which point to data tables.&lt;BR /&gt;     {"Table1","Table2"}    // A list of data table names&lt;BR /&gt;     { data table( "Table1" ), data table( "Table2" ) }     // a list of pointers to data tables</description>
      <pubDate>Sun, 03 Jan 2021 22:10:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/rename-column-names-in-a-jmp-file-as-per-values-in-rows-in-a/m-p/345254#M59564</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-03T22:10:08Z</dc:date>
    </item>
  </channel>
</rss>

