<?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: Get distinct entries from a list? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820562#M99924</link>
    <description>&lt;P&gt;... so, I just tried it with 5 mio rows - and got an interesting insight:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1733308275918.png" style="width: 554px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70826i21C91538C8124698/image-dimensions/554x132?v=v2" width="554" height="132" role="button" title="hogi_1-1733308275918.png" alt="hogi_1-1733308275918.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I save the table, close JMP and load the table again, the memory usage is significantly less than what is needed to calculate the values!&lt;BR /&gt;&lt;BR /&gt;At&amp;nbsp; first sight, I thought it's due to the Associative Array, but the same thing happens when I use &lt;FONT face="courier new,courier"&gt;mylist&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;How can I prevent the column formula from eating my memory?&lt;BR /&gt;&lt;BR /&gt;TS-00177710&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2024 19:46:31 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2024-12-12T19:46:31Z</dc:date>
    <item>
      <title>Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820485#M99910</link>
      <description>&lt;P&gt;is there a simple way to obtain the distinct entries in a list? (similar to summary of a table by grouping column in order to get distinct entries in that column)&lt;BR /&gt;The result could be either a reduced list containing only the distinct entries (repeated ones removed) or just a number showing the amount of different entries.&lt;BR /&gt;Before writing a script I would like to check if there is a simple way / function / formula. Couldn't find anything in the JMP help ...&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 02:10:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820485#M99910</guid>
      <dc:creator>katharina_l</dc:creator>
      <dc:date>2024-12-04T02:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820495#M99911</link>
      <description>&lt;P&gt;One way is to use an Associative Array&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

// Create a list
dt=
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
genderList = :sex &amp;lt;&amp;lt; get values;

// Get the distinct list of values
distinctList = (associative array(genderList))&amp;lt;&amp;lt;get keys;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;{"F", "M"}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 02:59:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820495#M99911</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-12-04T02:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820507#M99914</link>
      <description>&lt;P&gt;awesome, this works! Thank you very much Jim!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 04:24:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820507#M99914</guid>
      <dc:creator>katharina_l</dc:creator>
      <dc:date>2024-12-04T04:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820519#M99916</link>
      <description>&lt;P&gt;The approach via &lt;FONT face="courier new,courier"&gt;associative array&lt;/FONT&gt; is easy to script / remember / apply.&lt;BR /&gt;Take care if you want to get the distinct values for a list of&amp;nbsp; mio of values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A workaround:&amp;nbsp;&lt;BR /&gt;save the values to a table and use either summarize or the tables/summary which you mentioned above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe, in the future, there will be a direct / fast way in JMP to calculate unique values?&lt;BR /&gt;I added this hope as a subtopic to&amp;nbsp;&lt;LI-MESSAGE title="Col N Categories - and all the others ..." uid="592610" url="https://community.jmp.com/t5/JMP-Wish-List/Col-N-Categories-and-all-the-others/m-p/592610#U592610" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;BR /&gt;Please support the idea and vote : )&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 06:43:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820519#M99916</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-04T06:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820530#M99918</link>
      <description>&lt;P&gt;Actually, my problem is that I want to detect unique entries in a sequence of strings in a table. Here I attached an example: Originally I have the column "sequence" (arbitrary delimiter, here the delimiter is "|). My actual workaround now is to transform this to a list and then apply Jim's solution with the associative array. But an easy way to calculate unique values would be highly appreciated ...&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 07:17:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820530#M99918</guid>
      <dc:creator>katharina_l</dc:creator>
      <dc:date>2024-12-04T07:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820531#M99919</link>
      <description>&lt;P&gt;Oh yeah, this is where the associative arrays hurt!&lt;BR /&gt;At the end you count the entries. Is this what you need - or do you also need the intermediate step (with the list of unique entries)?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;A quick and easy way to handle unique values - let's hope that the JMP developers recognize this topic as something really useful. Such that it gets implemented in the next release ...&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 08:01:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820531#M99919</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-04T08:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820532#M99920</link>
      <description>&lt;P&gt;For my current application, I only need the number of distinct entries, not the values themselves. But I think there might be many more situations where it would be helpful to reduce a list to its unique entries.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;And yeah, let's hope for implementation in the next release :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 08:09:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820532#M99920</guid>
      <dc:creator>katharina_l</dc:creator>
      <dc:date>2024-12-04T08:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820537#M99922</link>
      <description>&lt;P&gt;Regarding speed, I just checked if the intermediate steps gets faster if I replace the associative array part with a simple&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;If(not(contains(), insert into(mylist ...&amp;nbsp;&lt;/FONT&gt;- no benefit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "unique entries",
	Expression,
	Formula(
		Local( {nr = N Rows( Current Data Table() )},
			If( Row() == nr,
				Caption( "done" )
			);
			Match( :variant,
				1, Associative Array( :list from sequence[Empty()] ) &amp;lt;&amp;lt; get keys,
				2,
					myList = {};
					For Each( {entry}, :list from sequence,
						If( !Contains( myList, entry ),
							Insert Into( myList, entry )
						)
					);
					myList;
			);
		)
	)
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;for 1mio rows, I get:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_2-1733302159526.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70824i9F07440AAE02E37B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_2-1733302159526.png" alt="hogi_2-1733302159526.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So 1:0 for associative arrays. Any better idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Another 2+2 seconds are needed for the columns&amp;nbsp;&lt;CODE class=" language-jsl"&gt;:list from sequence&lt;/CODE&gt;&amp;nbsp;and :&lt;FONT face="courier new,courier"&gt;N unique entries.&lt;BR /&gt;&lt;/FONT&gt;So, no real benefit to get into the ms regime for the intermediate step]&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 12:05:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820537#M99922</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-04T12:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820558#M99923</link>
      <description>&lt;P&gt;- easy&lt;/P&gt;&lt;P&gt;- fast&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and:&lt;BR /&gt;- not greedy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just tried to check the timing with 10 mio rows - and got stuck.&lt;BR /&gt;JMP crashes and the last 60 seconds look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1733308211187.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70825i066C6E4298951031/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1733308211187.png" alt="hogi_0-1733308211187.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 10:30:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820558#M99923</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-04T10:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820562#M99924</link>
      <description>&lt;P&gt;... so, I just tried it with 5 mio rows - and got an interesting insight:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1733308275918.png" style="width: 554px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70826i21C91538C8124698/image-dimensions/554x132?v=v2" width="554" height="132" role="button" title="hogi_1-1733308275918.png" alt="hogi_1-1733308275918.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I save the table, close JMP and load the table again, the memory usage is significantly less than what is needed to calculate the values!&lt;BR /&gt;&lt;BR /&gt;At&amp;nbsp; first sight, I thought it's due to the Associative Array, but the same thing happens when I use &lt;FONT face="courier new,courier"&gt;mylist&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;How can I prevent the column formula from eating my memory?&lt;BR /&gt;&lt;BR /&gt;TS-00177710&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 19:46:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820562#M99924</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-12T19:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820630#M99934</link>
      <description>&lt;P&gt;FWIW here's a unique values function I wrote a while ago:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*
Function Name: get_unique_values
Description: Find the unique values in a list.  Uses an associative array
Arguments:
in_list		List to get unique values for
*/
Get_unique_values = Function( {in_list},
      {Default Local}, 
      tmp = [=&amp;gt; 0]; 
      Insert Into( tmp, in_list ); 
      tmp &amp;lt;&amp;lt; get keys; 
); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Sample calls:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = {1, 1, 1, 2, 3, 3, 3};
b = get_unique_values(a);
print(b);

c = {"Hello", "World", "John", "Ed", "John", "World"};
d = get_unique_values(c);
print(d);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;PRE&gt;{1, 2, 3}
{"Ed", "Hello", "John", "World"}&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2024 15:13:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820630#M99934</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2024-12-04T15:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820664#M99941</link>
      <description>&lt;P&gt;How complicate sequences do you have (are they just single letter?)? Do you know beforehand what they could potentially be? And how long can the sequence be?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For just calculating the amount of entries, you can use combination of N Items + Associative Array and Words&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;N Items(Associative Array(Words(:sequence, "|")))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Partially related&lt;LI-MESSAGE title="Provide fast way to get unique values from JMP objects (column, lists), possibly similar to Python's Set" uid="446833" url="https://community.jmp.com/t5/JMP-Wish-List/Provide-fast-way-to-get-unique-values-from-JMP-objects-column/m-p/446833#U446833" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 16:35:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820664#M99941</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-04T16:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820668#M99944</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;wrote:&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;N Items(Associative Array(Words(:sequence, "|")))&lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe I am wrong, but this suggestion looks very similar to what&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6110"&gt;@katharina_l&lt;/a&gt;&amp;nbsp;posted in&amp;nbsp;&lt;BR /&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820530/highlight/true#M99918" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820530/highlight/true#M99918&lt;/A&gt;&amp;nbsp;? ?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 17:32:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820668#M99944</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-04T17:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820757#M99959</link>
      <description>&lt;P&gt;thank you Holger and yes, definitely looks like the function I was looking for. Would be great if it could be implemented as a standard function in JMP.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2024 00:33:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/820757#M99959</guid>
      <dc:creator>katharina_l</dc:creator>
      <dc:date>2024-12-05T00:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get distinct entries from a list?</title>
      <link>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/871599#M103549</link>
      <description>&lt;P&gt;&lt;A class="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa" href="https://community.jmp.com/t5/JMP-Wish-List/Col-N-Categories/m-p/592610#U592610" target="_blank"&gt;Col N Categories&amp;nbsp;&lt;/A&gt;&amp;nbsp;will come with JMP19.&lt;BR /&gt;&lt;BR /&gt;For&amp;nbsp;&lt;LI-MESSAGE title="Get Unique Items" uid="847547" url="https://community.jmp.com/t5/JMP-Wish-List/Get-Unique-Items/m-p/847547#U847547" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;there is a separate wish - waiting for Kudos.&lt;/P&gt;</description>
      <pubDate>Sat, 03 May 2025 15:15:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-distinct-entries-from-a-list/m-p/871599#M103549</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-05-03T15:15:51Z</dc:date>
    </item>
  </channel>
</rss>

