<?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 columns using an associative array in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347328#M59811</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3605"&gt;@ian_jmp&lt;/a&gt;&amp;nbsp;Took me way too long to see the "1"!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/Big Class.jmp" );
//Use and array to rename the Big Class table columns to "spanish"
newColNames = Associative Array();
newColNames["name"] = "nombre";
newColNames["age"] = "edad";
newColNames["sex"] = "sexo";
newColNames["height"] = "altura";
newColNames["weight"] = "peso";

uno = newColNames &amp;lt;&amp;lt; Get Keys(); //for testing

newN = newColNames &amp;lt;&amp;lt; Get Values( {"age"} ); //for testing

oriNames = dt &amp;lt;&amp;lt; Get Column Names( "string" ); // in case there are variation on the number/name of columns

For( i = 1, i &amp;lt;= N Items( oriNames ), i++,
	key = oriNames[i];
	Column( dt, key ) &amp;lt;&amp;lt; set name( newColNames[key] );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Jan 2021 17:45:03 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2021-01-11T17:45:03Z</dc:date>
    <item>
      <title>Rename columns using an associative array</title>
      <link>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347226#M59806</link>
      <description>&lt;P&gt;Hi, I am trying to use an associative array to rename a bunch of columns. I have been using the Big Class data as an example. I will appreciate some help fixing my script.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table ("Big Class.jmp");
//Use and array to rename the Big Class table columns to "spanish"
newColNames = Associative Array();
newColNames["name"] = "nombre";
newColNames["age"] = "edad";
newColNames["sex"] = "sexo";
newColNames["height"] = "altura";
newColNames["weight"] = "peso";

uno = newColNames &amp;lt;&amp;lt; Get Keys(); //for testing

newN = newColNames &amp;lt;&amp;lt; Get Values({"name"}); //for testing

oriNames = dt &amp;lt;&amp;lt; Get Column Names(); // in case there are variation on the number/name of columns

For( i=1, 1 &amp;lt;= N Items(oriNames), i++,
key = oriNames[i];

	Column(dt, key ) &amp;lt;&amp;lt; set name (newColNames&amp;lt;&amp;lt;Get Values ({key}));
	
); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:24:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347226#M59806</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2023-06-10T23:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rename columns using an associative array</title>
      <link>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347327#M59810</link>
      <description>&lt;P&gt;You were very close:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Open("$SAMPLE_DATA/Big Class.jmp");

//Use and array to rename the Big Class table columns to "spanish"
newColNames = Associative Array();
newColNames["name"] = "nombre";
newColNames["age"] = "edad";
newColNames["sex"] = "sexo";
newColNames["height"] = "altura";
newColNames["weight"] = "peso";

oriNames = dt &amp;lt;&amp;lt; Get Column Names("String"); 	// in case there are variation on the number/name of columns

For( i=1, i &amp;lt;= N Items(oriNames), i++,
	key = oriNames[i];
	Column(dt, key ) &amp;lt;&amp;lt; set name ( newColNames &amp;lt;&amp;lt; Get Value (key) );
); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 17:41:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347327#M59810</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-01-11T17:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Rename columns using an associative array</title>
      <link>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347328#M59811</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3605"&gt;@ian_jmp&lt;/a&gt;&amp;nbsp;Took me way too long to see the "1"!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/Big Class.jmp" );
//Use and array to rename the Big Class table columns to "spanish"
newColNames = Associative Array();
newColNames["name"] = "nombre";
newColNames["age"] = "edad";
newColNames["sex"] = "sexo";
newColNames["height"] = "altura";
newColNames["weight"] = "peso";

uno = newColNames &amp;lt;&amp;lt; Get Keys(); //for testing

newN = newColNames &amp;lt;&amp;lt; Get Values( {"age"} ); //for testing

oriNames = dt &amp;lt;&amp;lt; Get Column Names( "string" ); // in case there are variation on the number/name of columns

For( i = 1, i &amp;lt;= N Items( oriNames ), i++,
	key = oriNames[i];
	Column( dt, key ) &amp;lt;&amp;lt; set name( newColNames[key] );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2021 17:45:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347328#M59811</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-01-11T17:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rename columns using an associative array</title>
      <link>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347350#M59812</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3605"&gt;@ian_jmp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for you help. Important lessons: check you i's and "Get Values" and "Get Value".&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;AL&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2021 18:12:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Rename-columns-using-an-associative-array/m-p/347350#M59812</guid>
      <dc:creator>ALopez</dc:creator>
      <dc:date>2021-01-11T18:12:57Z</dc:date>
    </item>
  </channel>
</rss>

