<?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: Finding how many times an entry has been repeated within a column using JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737338#M91846</link>
    <description>&lt;P&gt;You can use Summarize to find count of items and then to find top 5 you can for example use Reverse(Rank()) on the count and use those found indices on your groups&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Get each different string value and the number of repeated strings
Summarize(dt, uniq = by(:age), count = Count(:height)); // some column which is numeric to Count

r = Reverse(Rank(count));
top5 = Try(uniq[r][1::5], uniq[r]);

show(uniq, count, top5);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 19:06:50 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-03-21T19:06:50Z</dc:date>
    <item>
      <title>Finding how many times an entry has been repeated within a column using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737026#M91792</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing a jsl script to find the repeated string entries (i.e. rows) in a column. The column is basically listing different tests that usually is repeated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to find is that if I can find the number of times those rows have been repeated, select the top N repeated entries, and then insert those selected entries into a list to be analyzed by graph builder or tabulate.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 23:03:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737026#M91792</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-03-20T23:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Finding how many times an entry has been repeated within a column using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737041#M91796</link>
      <description>&lt;P&gt;Here is how I would approach this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();

// Get each different string value and the number of repeated strings
summarize(dt, byGroup = by(:sex), number = count(:height));
show( byGroup, number );

// To find which rows that have the same values
theRows = dt &amp;lt;&amp;lt; get rows where( :sex == byGroup[1] );
show(theRows);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Mar 2024 23:59:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737041#M91796</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-03-20T23:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Finding how many times an entry has been repeated within a column using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737060#M91803</link>
      <description>&lt;P&gt;Could you provide example (and solution to the example) so it is easier to understand what you are trying to achieve as at least three different cases comes to my mind.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 05:27:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737060#M91803</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-21T05:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Finding how many times an entry has been repeated within a column using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737307#M91837</link>
      <description>&lt;P&gt;thank you&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;for your solution. This works perfectly in find the duplicate columns and how many times they were duplicated. The issue I'm having now is that I'm trying to find the top N (ex: N =5) repeated strings and throw them in a list for further evaluation. I was only being able to find the top item in the list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question, is there are a way to find the top N items where N can be any integer? Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;I have modified the code as seen below:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();
// Get each different string value and the number of repeated strings
summarize(dt, byGroup = by(:Temp_), number = count(:Site));


list = {};
list[1] = 0;
// To find which rows that have the same values
for(i=2, i &amp;lt;N Items(byGroup),i++,
 list[i] = N Items ( theRows = dt &amp;lt;&amp;lt; get rows where( :Temp_ == byGroup[i] ) )   ; // creating a list of how many times those items were repeated. 
 //numoffail = N items(list);
  buf = max(list); // finding how many times the top repeated items were repeated. 
 	highest =byGroup[loc(list,buf)]; // match the number of repetition to the repeated string to find the most repeated  
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Mar 2024 17:26:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737307#M91837</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-03-21T17:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Finding how many times an entry has been repeated within a column using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737334#M91842</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;An example of that would be Sex column in big class jmp data. There is F and M in the column, and it is repeated multiple times. I would like to write a jsl script that counts how many times F or M was repeated. The code that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;provided works perfectly in this case. Does this make more sense ? Thanks&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:40:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737334#M91842</guid>
      <dc:creator>RA899</dc:creator>
      <dc:date>2024-03-21T18:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Finding how many times an entry has been repeated within a column using JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737338#M91846</link>
      <description>&lt;P&gt;You can use Summarize to find count of items and then to find top 5 you can for example use Reverse(Rank()) on the count and use those found indices on your groups&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

// Get each different string value and the number of repeated strings
Summarize(dt, uniq = by(:age), count = Count(:height)); // some column which is numeric to Count

r = Reverse(Rank(count));
top5 = Try(uniq[r][1::5], uniq[r]);

show(uniq, count, top5);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 19:06:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-how-many-times-an-entry-has-been-repeated-within-a/m-p/737338#M91846</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-21T19:06:50Z</dc:date>
    </item>
  </channel>
</rss>

