<?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: Keeping duplicate columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46799#M26661</link>
    <description>&lt;P&gt;What you are asking for is the default action taken in JMP when you Join 2 data tables.&amp;nbsp; If they have columns of the same name in both data tables, JMP renames the columns.&amp;nbsp; Here is a script version, however, if you have 2 tables, you can interactively do this by&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Tables==&amp;gt;Join&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = Open( "$SAMPLE_DATA\big class.jmp" );
dt2 = Open( "$SAMPLE_DATA\big class Families.jmp" );

Data Table( "big class Families" ) &amp;lt;&amp;lt; Join( With( Data Table( "big class" ) ), 
	By Row Number );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Nov 2017 03:18:14 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2017-11-06T03:18:14Z</dc:date>
    <item>
      <title>Keeping duplicate columns</title>
      <link>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46733#M26623</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have 2 data table and these table are similar to certain extent where the test parameters(which means perhaps 30% of the columns sharing the same name) are same as they are different by test location hence the test result will be different as well. I intend to combine this table using Update and at the same time maintaining the 2nd table columns data but automatic rename those columns so that I can view them side by side. Can this done via scripts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 09:18:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46733#M26623</guid>
      <dc:creator>adam</dc:creator>
      <dc:date>2017-11-03T09:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping duplicate columns</title>
      <link>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46734#M26624</link>
      <description>&lt;P&gt;I am not sure exactly what you want to do, but yes you can rename columns using a script.&amp;nbsp; If you open each data table and keep separate references to each, you can send messages to all of them to rename columns:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here( 1 );

//Open two tables
dt1 = Open("$SAMPLE_DATA/Iris.jmp"); //first table
dt1 &amp;lt;&amp;lt; Set Name( "Table 1" );
dt2 = Open("$SAMPLE_DATA/Iris.jmp"); //second table (different filename)
dt2 &amp;lt;&amp;lt; Set Name( "Table 2" );

//Concatenate tables
dtJoined = dt1 &amp;lt;&amp;lt; Concatenate( dt2 );
dtJoined &amp;lt;&amp;lt; Set Name( "Combined" );

//Change column names
Column( dt1, "Sepal length" ) &amp;lt;&amp;lt; Set Name( "Sepal_length" );
Column( dt2, "Sepal length" ) &amp;lt;&amp;lt; Set Name( "Sepal_length" );
Column( dtJoined, "Sepal length" ) &amp;lt;&amp;lt; Set Name( "Sepal_length" );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If changing a lot of column names you could use a function to replace the last three lines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Make a function to change column names in all tables
ChangeAllNames = function({original, new},
	Column( dt1, original ) &amp;lt;&amp;lt; Set Name( new );
	Column( dt2, original ) &amp;lt;&amp;lt; Set Name( new );
	Column( dtJoined, original ) &amp;lt;&amp;lt; Set Name( new );
);

//Then call the function
ChangeAllNames( "Sepal width", "Sepal_width" );
ChangeAllNames( "Petal length", "Petal_Length" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Nov 2017 11:47:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46734#M26624</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2017-11-03T11:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping duplicate columns</title>
      <link>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46797#M26660</link>
      <description>&lt;P&gt;Thanks ih. Though this is not exactly what I want but the idea is there. Attached file is something that I wanna do.Joining 2 data table and auto renamed 2nd data table columns that matched the 1st data table. Sorry, if there is any confusion from my initial message.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 02:53:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46797#M26660</guid>
      <dc:creator>adam</dc:creator>
      <dc:date>2017-11-06T02:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping duplicate columns</title>
      <link>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46799#M26661</link>
      <description>&lt;P&gt;What you are asking for is the default action taken in JMP when you Join 2 data tables.&amp;nbsp; If they have columns of the same name in both data tables, JMP renames the columns.&amp;nbsp; Here is a script version, however, if you have 2 tables, you can interactively do this by&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Tables==&amp;gt;Join&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = Open( "$SAMPLE_DATA\big class.jmp" );
dt2 = Open( "$SAMPLE_DATA\big class Families.jmp" );

Data Table( "big class Families" ) &amp;lt;&amp;lt; Join( With( Data Table( "big class" ) ), 
	By Row Number );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Nov 2017 03:18:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46799#M26661</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-11-06T03:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping duplicate columns</title>
      <link>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46800#M26662</link>
      <description>&lt;P&gt;To expand on Jim's point you will need to join by row as you do not appear to have a key pair as in a typical join.&amp;nbsp; I am having a hard time understanding why you would join the tables in this way; does SN AX0001 relate to STX0030 but not STX0031?&amp;nbsp; If so maybe there is another column you could add to both tables to join them in a more meaningful way.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 03:29:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46800#M26662</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2017-11-06T03:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Keeping duplicate columns</title>
      <link>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46801#M26663</link>
      <description>&lt;P&gt;Thanks ih &amp;amp; Jim. That's right in normal circumstances, with less variables the table can be joined without any issues.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2017 03:58:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Keeping-duplicate-columns/m-p/46801#M26663</guid>
      <dc:creator>adam</dc:creator>
      <dc:date>2017-11-06T03:58:26Z</dc:date>
    </item>
  </channel>
</rss>

