<?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: How to create a formula column to find the maximum of several columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/8061#M8055</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A __default_attr="466770" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://community.jmp.com/"&gt;&lt;/A&gt; ! I knew it had to be something simple. &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.jmp.com/5.0.2/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Feb 2014 13:57:57 GMT</pubDate>
    <dc:creator>adampaulsmith</dc:creator>
    <dc:date>2014-02-04T13:57:57Z</dc:date>
    <item>
      <title>How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/8059#M8053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have several columns of numeric data (see example below) and I would like to create a formula column to find the maximum value for each row across the columns.&amp;nbsp; Any help would be appreciated.&amp;nbsp; Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Value 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Value 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max Value (I would put the formula in this column)&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 22:00:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/8059#M8053</guid>
      <dc:creator>adampaulsmith</dc:creator>
      <dc:date>2014-02-03T22:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/8060#M8054</link>
      <description>&lt;P&gt;The &lt;A href="https://www.jmp.com/support/help/14-2/statistical-functions-2.shtml#2754448" target="_self"&gt;Maximum() function&lt;/A&gt; will do this for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Maximum(:Value 1, :Value 2, :Value 3)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Mar 2019 19:33:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/8060#M8054</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-03-27T19:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/8061#M8055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A __default_attr="466770" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://community.jmp.com/"&gt;&lt;/A&gt; ! I knew it had to be something simple. &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.jmp.com/5.0.2/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 13:57:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/8061#M8055</guid>
      <dc:creator>adampaulsmith</dc:creator>
      <dc:date>2014-02-04T13:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/189807#M40847</link>
      <description>&lt;P&gt;If you have many rows which you want to search, is there a function to select a range of rows as opposed to typing in every row into the function?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 18:37:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/189807#M40847</guid>
      <dc:creator>NDENNIS418</dc:creator>
      <dc:date>2019-03-27T18:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/189852#M40854</link>
      <description>&lt;P&gt;The question asked by&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4270"&gt;@adampaulsmith&lt;/a&gt; and answered by&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4550"&gt;@pmroz&lt;/a&gt; uses the Maximum() function in a formula define for the resulting column.&amp;nbsp; The formula will automatically loop across each row and apply the formula.&amp;nbsp; Thus, no row reference has to be made.&lt;/P&gt;
&lt;P&gt;However, if you are using this in open JSL, you can add a subscript to the column references to indicate which row you process.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( theRow = 1, theRow &amp;lt;= 10, theRow++,
     :MaxValue[theRow] = Maximum( :Value 1[theRow], :Value 2[theRow], :Value 2[theRow] );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See documentation on JSL in the Scripting Guide&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Help==&amp;gt;Books==&amp;gt;Scripting Guide&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 20:47:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/189852#M40854</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-03-27T20:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/254713#M50011</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;I am having a similar problem. Where I want to get the maximum of multiple columns. In my example I have a list of columns called FreqList. That I created using a formula similar to,&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();


FreqList = dt &amp;lt;&amp;lt; get column names( string, numeric );

For( i = N Items( FreqList ), i &amp;gt;= 1, i--,
If( Contains( FreqList[i], "Unique" )== 0,
FreqList= Remove( FreqList, i, 1 ),
Contains( FreqList[i], "Name" )== 0,
FreqList = Remove( FreqList, i, 1 )
)
);

// Then&amp;nbsp; I was thinking something like the following should work,

dt &amp;lt;&amp;lt; New Column ("Freq", numeric, Formula(Col Max(FreqList)));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The manual way of me doing it would be to create a new column called "Freq". Then creating a formula like Maximum(:Freq1,:Freq2,:Freq3,FreqN),which would create a new column that has the max freq based on the row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I do this in JSL?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 23:36:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/254713#M50011</guid>
      <dc:creator>GabeM27</dc:creator>
      <dc:date>2020-03-27T23:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/254723#M50016</link>
      <description>&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;The syntax you made up for your example will not work, however, what I have gleaned from it, is that you want to create a new column that contains the maximum value across a list of columns.&amp;nbsp; The code specified in a formula, such as&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:a * 2 + :b&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;must be input as the actual literal string one wants for the formula.&amp;nbsp; JMP will not do any evaluation of the JSL in the formula before it is pass on to the new column being created.&amp;nbsp; Therefore, the formula one wants to use, must be fully realized.&amp;nbsp; And in your code, it needs to be dynamic, which requires the formula statement to be created in JSL and then passed to the formula.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: inherit; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 300; letter-spacing: normal; line-height: 1.7142; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Below is a script that shows one way of doing that&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = Current Data Table();


// The formula that needs to be passed into the new column JSL needs
// to look like
//     Max( :NameA, :UniqueX, :Name bb )
// A literal string of ":NameA, :UniqueX, :Name bb" needs to be created
// and then plugged into the JSL and then executed
//  ":NameA, :UniqueX, :Name bb" is just an illustration, what the 
// make up of the string needs to be derived from the actual column
// names in the data table
FreqList = dt &amp;lt;&amp;lt; get column names( string, numeric );
freqString = "";

// build the JSL in the form that is required for the formula
For( i = 1, i &amp;lt;= N Items( FreqList ), i++,
	If(
		Contains( FreqList[i], "Unique" ) == 1 |
		Contains( FreqList[i], "Name" ) == 1, 
		If( i==1, delim = "", delim = ",");
		freqString = freqString || delim || " :" || FreqList[i]
	)
);

// Run the command, passing into the formula the command string developed above
Eval( Parse( "dt &amp;lt;&amp;lt; New Column (\!"Freq\!", numeric, Formula( Max( " || freqString || " )));" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Mar 2020 02:22:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/254723#M50016</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-03-28T02:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/255155#M50087</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp; You are a wizard! Thank you for the help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 21:19:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/255155#M50087</guid>
      <dc:creator>GabeM27</dc:creator>
      <dc:date>2020-03-30T21:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/482302#M72665</link>
      <description>&lt;P&gt;This may be non sequitur, but what column formula would result in not the &amp;lt;value&amp;gt; of the maximum column, but the &amp;lt;column name&amp;gt; of the column with the maximum value?&amp;nbsp; TIA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 17:24:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/482302#M72665</guid>
      <dc:creator>Devin</dc:creator>
      <dc:date>2022-04-26T17:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/482357#M72671</link>
      <description>&lt;P&gt;here is a simple example displaying the column name of the max column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

dt &amp;lt;&amp;lt; New Column( "Example",
	character,
	formula(
		If( Row() == 1,
			namelist = {"NPN1", "NPN2", "NPN3", "NPN4"}
		);
		maxes = [];
		For( i = 1, i &amp;lt;= N Items( namelist ), i++,
			maxes = maxes || Matrix( Column( namelist[i] )[Row()] )
		);
		If( Row() &amp;lt;= 5,
			Show( maxes )
		);
		namelist[Loc( maxes, Max( maxes ) )[1]];
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 05:12:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/482357#M72671</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-04-27T05:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a formula column to find the maximum of several columns</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/690692#M87661</link>
      <description>&lt;P&gt;i'm not sure why, but txnelsons code didn't work for me.&lt;/P&gt;&lt;P&gt;after debugging, i had to change last line to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;namelist[ Loc( as list(maxes`), Max( maxes ) )[1] ];&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now it seems working&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 06:28:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-formula-column-to-find-the-maximum-of-several/m-p/690692#M87661</guid>
      <dc:creator>jetpeach</dc:creator>
      <dc:date>2023-10-26T06:28:06Z</dc:date>
    </item>
  </channel>
</rss>

