<?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: Minimum function in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Minimum-function/m-p/606768#M80867</link>
    <description>&lt;P&gt;Any chance you could share a sample data table to help make this more clear? The function Tables...Anonymize can make things easier to share, if PII or proprietary info can't be shared.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2023 19:43:34 GMT</pubDate>
    <dc:creator>Jed_Campbell</dc:creator>
    <dc:date>2023-03-01T19:43:34Z</dc:date>
    <item>
      <title>Minimum function</title>
      <link>https://community.jmp.com/t5/Discussions/Minimum-function/m-p/606725#M80863</link>
      <description>&lt;P&gt;I have two different dates for different people. First column (A) is person name. Second column is (B=index event date) and the third one is (C=intervention date). The fourth column is&amp;nbsp; the difference (D) between the two dates "B-C/ in days(1)" .&lt;BR /&gt;My question is how to let JMP choose specific value in D for each person (A). I need to select the value in the following timeframes:&lt;BR /&gt;1- The closest value in D before the index event date (B). Let's say one person has the following date difference values.&amp;nbsp; 0, -1, -10. I want zero in this case&lt;/P&gt;&lt;P&gt;2- The first value in D within 2 weeks after A (0 day up to 14 days) let's say a person has 2, 8, 14. I want 2&lt;BR /&gt;3- The first value in D after 2 weeks from A (15 days or more) Let's say a person has 17, 25, 35. I want 17&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:32:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Minimum-function/m-p/606725#M80863</guid>
      <dc:creator>AliSheffeh</dc:creator>
      <dc:date>2023-06-08T16:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Minimum function</title>
      <link>https://community.jmp.com/t5/Discussions/Minimum-function/m-p/606768#M80867</link>
      <description>&lt;P&gt;Any chance you could share a sample data table to help make this more clear? The function Tables...Anonymize can make things easier to share, if PII or proprietary info can't be shared.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 19:43:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Minimum-function/m-p/606768#M80867</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2023-03-01T19:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Minimum function</title>
      <link>https://community.jmp.com/t5/Discussions/Minimum-function/m-p/606907#M80870</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Jed mentions, more context is better, but I think I see what you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case (1), a maximum, but only among those differences less than or equal to zero.&lt;/P&gt;
&lt;P&gt;In case (2), a minimum, but only among those differences between 0 and 14, inclusive.&lt;/P&gt;
&lt;P&gt;In case (3), a minimum, but only among those differences 15 or greater.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is what you want, then in each case you can use the same idea:&lt;/P&gt;
&lt;P&gt;1) Dynamically set the data you DON'T want to missing, and then&lt;/P&gt;
&lt;P&gt;2) Compute the max or min of the data, while ignoring the missing data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the code below, each formula has the same structure:&lt;/P&gt;
&lt;P&gt;Col &amp;lt;&amp;lt;max or min&amp;gt;&amp;gt; ( If ( I want to ignore the data, make it missing, else use the original data), &amp;lt;&amp;lt;grouping variable&amp;gt;&amp;gt; ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So which data do we want to ignore?&lt;/P&gt;
&lt;P&gt;In case ( 1 ), it is :diff &amp;gt; 0... any difference greater than 0&lt;/P&gt;
&lt;P&gt;In case ( 2 ), it is ! ( 0 &amp;lt;= :diff &amp;lt;= 14)... any difference not between 0 and 14 inclusive&lt;/P&gt;
&lt;P&gt;In case ( 3 ), it is :diff &amp;lt; 15... any difference less than 15&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Running the code you will see a table like the one below. In my code, the grouping column is the "person" column... and I've just simulated the differences, as from your description that's the column of interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Brady&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
nr = 50;
dt = New Table( "ex",
	New Column( "Person", character, &amp;lt;&amp;lt;set values( Words( "abcde", "" )[J( nr, 1, Random Integer( 1, 5 ) )] ) ),
	New Column( "diff", &amp;lt;&amp;lt;set values( J( nr, 1, Random Integer( -10, 30 ) ) ) )
);
dt &amp;lt;&amp;lt; sort( by( :person, :diff ), order( ascending, ascending ), replace table );
dt &amp;lt;&amp;lt; New Column( "form_1", formula( Col Max( If( :diff &amp;gt; 0, ., :diff ), :Person ) ) );
dt &amp;lt;&amp;lt; New Column( "form_2", formula( Col Min( If( !(0 &amp;lt;= :diff &amp;lt;= 14), ., :diff ), :Person ) ) );
dt &amp;lt;&amp;lt; New Column( "form_3", formula( Col Min( If( :diff &amp;lt; 15, ., :diff ), :Person ) ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="brady_brady_0-1677714484430.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/50591i3310628BAEF2CB93/image-size/large?v=v2&amp;amp;px=999" role="button" title="brady_brady_0-1677714484430.png" alt="brady_brady_0-1677714484430.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 23:51:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Minimum-function/m-p/606907#M80870</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2023-03-01T23:51:06Z</dc:date>
    </item>
  </channel>
</rss>

