<?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: Select rows with maximal values in one column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3373#M3373</link>
    <description>&lt;P&gt;For Each Row() can be inefficient for large tables.&lt;BR /&gt;&lt;BR /&gt;Select Where() will probably be faster:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; clear select;
Summarize( g = by( :age ), m = Max( :height ) );

dt&amp;lt;&amp;lt;Select Where(:height==m[loc(g,char(:age) )]);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;!--&lt;br /&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;br /&gt;dt &lt;&lt; clear select;&lt;br /&gt;Summarize( g = by( :age ), m = Max( :height ) );&lt;br /&gt;&lt;br /&gt;dt&lt;&lt;Select Where(:height==m[loc(g,char(:age) )]);&lt;br &gt;&lt;/Select&gt;&lt;br /&gt;--&gt;</description>
    <pubDate>Wed, 04 Oct 2017 20:09:45 GMT</pubDate>
    <dc:creator>Jeff_Perkinson</dc:creator>
    <dc:date>2017-10-04T20:09:45Z</dc:date>
    <item>
      <title>Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3366#M3366</link>
      <description>I can use summary to find the maximums (multiple due to groups) in one column. However, I also want to look up in which rows in the original table the maximums occur.  &lt;BR /&gt;&lt;BR /&gt;Is there an easy solution?  Thanks for your help!</description>
      <pubDate>Thu, 12 May 2011 02:11:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3366#M3366</guid>
      <dc:creator>new-jmper</dc:creator>
      <dc:date>2011-05-12T02:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3367#M3367</link>
      <description>You can match the original table with the summary table using Update (Tables menu) with group column(s) = group column(s) and data = max(data) as matching columns. The maximum rows will be denoted by non-missing cells in the added NRows column.&lt;BR /&gt;&lt;BR /&gt;My first answer was based on sloppy thinking...&lt;BR /&gt;&lt;BR /&gt;    &lt;BR /&gt;Message was edited by: MS</description>
      <pubDate>Thu, 12 May 2011 09:11:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3367#M3367</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2011-05-12T09:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3368#M3368</link>
      <description>Rows-&amp;gt;Row Selection-&amp;gt;Select Dominant will select the rows with the maximum (or minimum) values in a column or group of columns. &lt;BR /&gt;&lt;BR /&gt;I believe that'll get you what you're looking for.&lt;BR /&gt;&lt;BR /&gt;Jeff</description>
      <pubDate>Thu, 12 May 2011 13:55:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3368#M3368</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2011-05-12T13:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3369#M3369</link>
      <description>Jeff,&lt;BR /&gt;&lt;BR /&gt;Thanks. This appears to be new feature from JMP 9.  I am using JMP 7.  I guess I may request an upgrade.&lt;BR /&gt;&lt;BR /&gt;Also, I am trying to select multiple maximums in one column. The maximums belong to different groups specified in other columns. &lt;BR /&gt;&lt;BR /&gt;Dong</description>
      <pubDate>Thu, 12 May 2011 17:43:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3369#M3369</guid>
      <dc:creator>new-jmper</dc:creator>
      <dc:date>2011-05-12T17:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3370#M3370</link>
      <description>MS,&lt;BR /&gt;&lt;BR /&gt;Thanks. I gave it a try and I am still selecting all rows in the original table when selecting the 2nd summary table.  Whenever I select one row (Max for the group) in the summary table, every row in the first summary table in the group also gets selected. &lt;BR /&gt;&lt;BR /&gt;I hope I am following your instruction correctly.  Is the 2nd summary table named as "DataTable By (group, data) By (group)" ?&lt;BR /&gt;&lt;BR /&gt;FYI, I am using JMP7.  &lt;BR /&gt;&lt;BR /&gt;Dong</description>
      <pubDate>Thu, 12 May 2011 18:28:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3370#M3370</guid>
      <dc:creator>new-jmper</dc:creator>
      <dc:date>2011-05-12T18:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3371#M3371</link>
      <description>&lt;P&gt;Sorry, you´re right. I was too quick to answer. I will edit my erroneous post above&lt;BR /&gt;&lt;BR /&gt;What I wanted to suggest is that you can try to combine Summary with Update (or Join, I am not sure Update is found in the JMP7 Tables Menu).&lt;BR /&gt;&lt;BR /&gt;Here's a script example that should work but may be ineffective for very large data tables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; clear select;
Summarize( g = by( :sex ), m = Max( :age ) );
For( j = 1, j &amp;lt;= N Items( g ), j++,
	For Each Row( If( :sex == g[j] &amp;amp; :age == m[j], Row State() = Selected State( 1 ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Oct 2017 20:09:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3371#M3371</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2017-10-04T20:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3372#M3372</link>
      <description>The script looks good. I will give it a try and report back.&lt;BR /&gt;&lt;BR /&gt;What surprised me is that JMP itself does not keep the index (row number) of the data maximum somewhere. &lt;BR /&gt;&lt;BR /&gt;Dong</description>
      <pubDate>Fri, 13 May 2011 16:13:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3372#M3372</guid>
      <dc:creator>new-jmper</dc:creator>
      <dc:date>2011-05-13T16:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3373#M3373</link>
      <description>&lt;P&gt;For Each Row() can be inefficient for large tables.&lt;BR /&gt;&lt;BR /&gt;Select Where() will probably be faster:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; clear select;
Summarize( g = by( :age ), m = Max( :height ) );

dt&amp;lt;&amp;lt;Select Where(:height==m[loc(g,char(:age) )]);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;!--&lt;br /&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );&lt;br /&gt;dt &lt;&lt; clear select;&lt;br /&gt;Summarize( g = by( :age ), m = Max( :height ) );&lt;br /&gt;&lt;br /&gt;dt&lt;&lt;Select Where(:height==m[loc(g,char(:age) )]);&lt;br &gt;&lt;/Select&gt;&lt;br /&gt;--&gt;</description>
      <pubDate>Wed, 04 Oct 2017 20:09:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3373#M3373</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2017-10-04T20:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3374#M3374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got JMP10 and revisited this problem.&amp;nbsp; "Join" using column matching&amp;nbsp; works well.&amp;nbsp; I guess table "update" seems would be even more straightforward.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 17:19:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3374#M3374</guid>
      <dc:creator>new-jmper</dc:creator>
      <dc:date>2013-03-28T17:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3375#M3375</link>
      <description>&lt;P&gt;I know this is two years later, but this is for all those who found this post with the same question.&lt;/P&gt;
&lt;P&gt;Try the function "Get Selected Rows" in your script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;yourarray = dt &amp;lt;&amp;lt; Get Selected Rows;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now the array "yourarray" will contain a list of the row numbers that are selected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To find the rows with the maximum value, try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// finds the maximum value in the columnt
peakvalue = Col Max( :columname); 

// selects all rows with the maximum value. (dt is the name of the data table.)
dt &amp;lt;&amp;lt; Select Where( :columnname == peakvalue);

 // stores a list of the row numbers with the maximum value in this array
yourarray = dt &amp;lt;&amp;lt; Get Selected Rows;    &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 20:08:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3375#M3375</guid>
      <dc:creator>mosfettesteng</dc:creator>
      <dc:date>2017-10-04T20:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3376#M3376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also use &lt;STRONG&gt;GET ROWS WHERE&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt;yourarray &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt; dt &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt; get rows where&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: #0000dd;"&gt;columnname&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;==&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black;"&gt; peakvalue&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: navy;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;The advantage of get rows where is that a) it's one step and not two, and b) no rows are selected in your table.&amp;nbsp; If you need the selected rows then the approach shown by MOSFETtestEng will do the trick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 18:38:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3376#M3376</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2013-08-02T18:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3377#M3377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fantastic solution. This is exactly what I was looking for!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jul 2016 10:10:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/3377#M3377</guid>
      <dc:creator>ankurtangirala</dc:creator>
      <dc:date>2016-07-18T10:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows with maximal values in one column</title>
      <link>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/283905#M54850</link>
      <description>&lt;P&gt;Hello, sorry to reply to an old thread, but I cannot find relevant examples elsewhere.&lt;/P&gt;
&lt;P&gt;I would like to summarize by group, then select those rows that have max weight by group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was able to Summarize, but I don't know how to select those rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt &amp;lt;&amp;lt; clear select;
Summarize( g = by( :age, :sex ), m = Max( :weight ) );

/* How to select those rows summarized by group?&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 17:14:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Select-rows-with-maximal-values-in-one-column/m-p/283905#M54850</guid>
      <dc:creator>mak</dc:creator>
      <dc:date>2020-08-03T17:14:48Z</dc:date>
    </item>
  </channel>
</rss>

