<?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: Combining entries of N columns into single column based on unique entries in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/46960#M26762</link>
    <description>&lt;P&gt;Here's an alternative to Jim's formula. The difference is that the &lt;SPAN&gt;unique values of the&amp;nbsp;&lt;/SPAN&gt;combined string are sorted&amp;nbsp;alphabetically rather than in order of occurence.&lt;/P&gt;
&lt;P&gt;The number of columns can generalized by setting the local parameter &lt;EM&gt;N&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt &amp;lt;&amp;lt; New Column("Combined",
    Character,
    Formula(
        Local({dt = Current Data Table(), N = 4},
            Concat Items(Associative Array(dt[Row(), 1 :: N]) &amp;lt;&amp;lt; get keys, ",")
        )
    )
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(It uses data table matrix notation, and will thus only in JMP 13 or later)&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2017 09:13:53 GMT</pubDate>
    <dc:creator>ms</dc:creator>
    <dc:date>2017-11-09T09:13:53Z</dc:date>
    <item>
      <title>Combining entries of N columns into single column based on unique entries</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/46954#M26758</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have N columns, which have character data that I want to consolidate into a single column.&amp;nbsp; For a given row many of the columns can be blank or contain repeated/same values ( as compared to the entry in another column ).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know there is the function under Cols --&amp;gt; Utilities --&amp;gt; Combine Columns &amp;amp; this will generate a new column with all the fields side by side &amp;amp; delimited.&amp;nbsp; I need advise on how to do this process while maintaining uniqueness ( i.e. only append the values for that column if there are no other columns w/in that row which have the same value )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally I'd like to get guidance on how to script this in JSL. However, clever ( yet more tedious ) approaches w/in JMP data tables/functions are welcome also!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:24:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/46954#M26758</guid>
      <dc:creator>mpanggabean</dc:creator>
      <dc:date>2023-06-09T23:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Combining entries of N columns into single column based on unique entries</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/46956#M26759</link>
      <description>&lt;P&gt;Here is one way to solve this question.&amp;nbsp; I have created a formula that combines the unique values from a list of columns.&amp;nbsp; I have attached a sample data table with the formula applied to the last column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Combined Unique Values.PNG" style="width: 714px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/8255iAB0D32216A574309/image-size/large?v=v2&amp;amp;px=999" role="button" title="Combined Unique Values.PNG" alt="Combined Unique Values.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Below is the formula used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;VarList = {"One", "Two", "Three", "Four"};
DataList = {};
CountList = {};
DataValue = "";
For( i = 1, i &amp;lt;= N Items( VarList ), i++,
	Insert Into( DataList, As Column( VarList[i] ) );
	Insert Into( CountList, 0 );
);
For( i = 1, i &amp;lt;= N Items( VarList ) - 1, i++,
	For( k = i + 1, k &amp;lt;= N Items( VarList ), k++,
		If( DataList[i] == DataList[k],
			CountList[k] = CountList[k] + 1
		)
	)
);
For( i = 1, i &amp;lt;= N Items( VarList ), i++,
	If( CountList[i] == 0 &amp;amp; DataList[i] != "",
		DataValue = DataValue || "," || DataList[i]
	)
);
DataValue = Substr( DataValue, 2 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Nov 2017 03:52:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/46956#M26759</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-11-09T03:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Combining entries of N columns into single column based on unique entries</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/46960#M26762</link>
      <description>&lt;P&gt;Here's an alternative to Jim's formula. The difference is that the &lt;SPAN&gt;unique values of the&amp;nbsp;&lt;/SPAN&gt;combined string are sorted&amp;nbsp;alphabetically rather than in order of occurence.&lt;/P&gt;
&lt;P&gt;The number of columns can generalized by setting the local parameter &lt;EM&gt;N&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
dt &amp;lt;&amp;lt; New Column("Combined",
    Character,
    Formula(
        Local({dt = Current Data Table(), N = 4},
            Concat Items(Associative Array(dt[Row(), 1 :: N]) &amp;lt;&amp;lt; get keys, ",")
        )
    )
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(It uses data table matrix notation, and will thus only in JMP 13 or later)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 09:13:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/46960#M26762</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2017-11-09T09:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining entries of N columns into single column based on unique entries</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47195#M26899</link>
      <description>&lt;P&gt;I&amp;nbsp;prefer the previous answers, but you can also do this via point-and-click, which is attractive to those who don't script (Apparently, there&amp;nbsp;exist&amp;nbsp;people who don't script!!)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As with the associative array approach,&amp;nbsp;the resulting column has the values&amp;nbsp;sorted least to greatest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Select the original columns, and using the combine columns utility, create a multiple response column.&lt;/P&gt;
&lt;P&gt;2)&amp;nbsp;Select&amp;nbsp;the new column and apply&amp;nbsp;the text to columns utility,&amp;nbsp;being sure to check the&amp;nbsp;check the "make indicators" box.&lt;/P&gt;
&lt;P&gt;3) After selecting the 10 new indicator columns,&amp;nbsp;apply the combine columns utility, being sure to check the "columns are indicator columns" box.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 00:41:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47195#M26899</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2017-11-14T00:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Combining entries of N columns into single column based on unique entries</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47197#M26901</link>
      <description>&lt;P&gt;Thank you Txnelson for the quick reply &amp;amp; solution!&lt;/P&gt;&lt;P&gt;This works fine, however, my column names are somewhat long &amp;amp; I have many so prefer not to have to manually specify the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could get the column names using a simple dt &amp;lt;&amp;lt; Get Column Names and store it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also really liked how super user "ms" arranged the entries in alphabetical order which reduces the # of permutations ( though I didn't ask for it )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the delayed response.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 04:55:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47197#M26901</guid>
      <dc:creator>mpanggabean</dc:creator>
      <dc:date>2017-11-14T04:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Combining entries of N columns into single column based on unique entries</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47198#M26902</link>
      <description>&lt;P&gt;Thanks a lot Ms!!&lt;/P&gt;&lt;P&gt;I like the flexibility of this solution including being able to specify the start and end column # to be used.&amp;nbsp; I really like that you also made the sorting in alphabetical order to reduce the # of permutations!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the delayed response. I initially thought there was a corner case problem where it was not working but after revisiting it I don't see an issue.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 04:59:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47198#M26902</guid>
      <dc:creator>mpanggabean</dc:creator>
      <dc:date>2017-11-14T04:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Combining entries of N columns into single column based on unique entries</title>
      <link>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47199#M26903</link>
      <description>Thanks Brady_Brady!!&lt;BR /&gt;Works for me too!!</description>
      <pubDate>Tue, 14 Nov 2017 05:15:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Combining-entries-of-N-columns-into-single-column-based-on/m-p/47199#M26903</guid>
      <dc:creator>mpanggabean</dc:creator>
      <dc:date>2017-11-14T05:15:21Z</dc:date>
    </item>
  </channel>
</rss>

