<?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: Max value of each row across multiple columns JMP10 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Max-value-of-each-row-across-multiple-columns-JMP10/m-p/38642#M22614</link>
    <description>&lt;P&gt;You can get the values as a matrix first and then grab each row from the matrix instead of the data table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Untitled",
	New Column( "a", Numeric, Set Values( [1, 33, 1] ) ),
	New Column( "b", Numeric, Set Values( [2, 2, 2] ) ),
	New Column( "c", Numeric, Set Values( [333, 1, 0] ) ),
	New Column( "maxval", numeric ),
	New Column( "maxcol", Numeric )
);

colnames = dt &amp;lt;&amp;lt; getcolumnnames;

values = dt &amp;lt;&amp;lt; Get As Matrix;

For Each Row(
	r = Row();
	// 1::3 means columns 1 through 3. {a,b,c} would also work.
	location = Loc Max( values[r, 1 :: 3] ); // location of maximum value in array
	maxval = dt[r, location];
	maxcol = colnames[location] &amp;lt;&amp;lt; getname;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 29 Apr 2017 10:56:34 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2017-04-29T10:56:34Z</dc:date>
    <item>
      <title>Max value of each row across multiple columns JMP10</title>
      <link>https://community.jmp.com/t5/Discussions/Max-value-of-each-row-across-multiple-columns-JMP10/m-p/38636#M22611</link>
      <description>&lt;P&gt;&lt;SPAN&gt;When I run below&amp;nbsp;script in JMP 10, I get an error message that says - argument should be matrix{1} in access or evaluation of 'Loc Max' , Bad Argument ... &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Looks like data table indexing is a feature in JMP13. What would be the work around in JMP10?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dt = New Table( "Untitled",&lt;BR /&gt;New Column( "a", Numeric, Set Values( [1, 33, 1] ) ),&lt;BR /&gt;New Column( "b", Numeric, Set Values( [2, 2, 2] ) ),&lt;BR /&gt;New Column( "c", Numeric, Set Values( [333, 1, 0] ) ),&lt;BR /&gt;New Column( "maxval", numeric ),&lt;BR /&gt;New Column( "maxcol", Numeric )&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;colnames = dt &amp;lt;&amp;lt; getcolumnnames;&lt;/P&gt;&lt;P&gt;For Each Row(&lt;BR /&gt;r = Row();&lt;BR /&gt;// 1::3 means columns 1 through 3. {a,b,c} would also work.&lt;BR /&gt;location = Loc Max( dt[ r, 1 :: 3] ); // location of maximum value in array&lt;BR /&gt;maxval = dt[r, location];&lt;BR /&gt;maxcol = colnames[location] &amp;lt;&amp;lt; getname;&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2017 23:59:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Max-value-of-each-row-across-multiple-columns-JMP10/m-p/38636#M22611</guid>
      <dc:creator>ravi_sasjmp</dc:creator>
      <dc:date>2017-04-28T23:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Max value of each row across multiple columns JMP10</title>
      <link>https://community.jmp.com/t5/Discussions/Max-value-of-each-row-across-multiple-columns-JMP10/m-p/38642#M22614</link>
      <description>&lt;P&gt;You can get the values as a matrix first and then grab each row from the matrix instead of the data table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Untitled",
	New Column( "a", Numeric, Set Values( [1, 33, 1] ) ),
	New Column( "b", Numeric, Set Values( [2, 2, 2] ) ),
	New Column( "c", Numeric, Set Values( [333, 1, 0] ) ),
	New Column( "maxval", numeric ),
	New Column( "maxcol", Numeric )
);

colnames = dt &amp;lt;&amp;lt; getcolumnnames;

values = dt &amp;lt;&amp;lt; Get As Matrix;

For Each Row(
	r = Row();
	// 1::3 means columns 1 through 3. {a,b,c} would also work.
	location = Loc Max( values[r, 1 :: 3] ); // location of maximum value in array
	maxval = dt[r, location];
	maxcol = colnames[location] &amp;lt;&amp;lt; getname;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Apr 2017 10:56:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Max-value-of-each-row-across-multiple-columns-JMP10/m-p/38642#M22614</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2017-04-29T10:56:34Z</dc:date>
    </item>
  </channel>
</rss>

