<?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 Help! Trying to calculate time differences using two different lists of dates in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49906#M28379</link>
    <description>&lt;P&gt;Hi! I have two lists of dates for a project, one is the Maintenance Dates and one is the Production Dates. I'm trying to figure out for each Production Date, how long has it been since the last Maintenance Date. The Maintenance Dates will be far less frequent than Production Dates, obviously, but there are a lot of them so it would be way easier to have a formula to calculate this delta. Anyone have any suggestions?&lt;/P&gt;</description>
    <pubDate>Sun, 21 Jan 2018 18:02:29 GMT</pubDate>
    <dc:creator>winslow</dc:creator>
    <dc:date>2018-01-21T18:02:29Z</dc:date>
    <item>
      <title>Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49906#M28379</link>
      <description>&lt;P&gt;Hi! I have two lists of dates for a project, one is the Maintenance Dates and one is the Production Dates. I'm trying to figure out for each Production Date, how long has it been since the last Maintenance Date. The Maintenance Dates will be far less frequent than Production Dates, obviously, but there are a lot of them so it would be way easier to have a formula to calculate this delta. Anyone have any suggestions?&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 18:02:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49906#M28379</guid>
      <dc:creator>winslow</dc:creator>
      <dc:date>2018-01-21T18:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49907#M28380</link>
      <description>&lt;P&gt;Hi, winslow!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JMP keeps track of datetimes as the number of seconds since midnight, 01January1904.&amp;nbsp; For instance, right now is&amp;nbsp;3599388994.&amp;nbsp; This makes it incredibly easy to keep track of time differences...it just requires some arithmetic and some formatting.&amp;nbsp; JMP formats support a bunch (14?) different ISO date formats, and you can even parse any unsupported date format into a JMP informat with a formula or script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may have more of a challenge putting your two lists together so you can perform all the arithmetic correctly.&amp;nbsp; Reply if you need any help with that, or if you have questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 21:26:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49907#M28380</guid>
      <dc:creator>Kevin_Anderson</dc:creator>
      <dc:date>2018-01-21T21:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49908#M28381</link>
      <description>&lt;P&gt;If you have 2 lists of dates, one called Prod(production dates) and one called Maint(maintenance dates), you can use the following to get the last&amp;nbsp;maintenance date.&amp;nbsp; Then using a Date Difference() function, you can find the difference in days&lt;/P&gt;
&lt;P&gt;Note:&amp;nbsp; The Maintenance list/matrix needs to be in ascending order.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
maint={.............};
prod={..............................};
For(i=1,i&amp;lt;=N Rows(prod),i++,
	LastMaintDate=loc sorted(matrix(maint),matrix(prod[i]));
	DaysDifference = Date Difference(prod,LastMaintDate,"Day");
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2018 22:30:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49908#M28381</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-01-21T22:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49914#M28387</link>
      <description>&lt;P&gt;Hmm I can't seem to get it to work... Maybe it's because the lists are independently generated and have nothing to do with one another (as far as JMP can tell). I guess let me re-frame my question: I have 1 list with Prod Lot, Prod Date/Time, Prod Equipment. In a separate list, I have Facilities Equipment (not the same thing as Prod Equipment), Facilities Maint Event, Facilities Maint Date/Time. They're two separate lists, I don't have any way of joining (no keys can be generated that would work), but I want to figure out for each Prod Date/Time what was the most recent Facilities Maint Date/Time (and I guess the Facilities Maint Event, although those are all just "on/off" events). Does that make sense?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 01:44:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49914#M28387</guid>
      <dc:creator>winslow</dc:creator>
      <dc:date>2018-01-22T01:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49915#M28388</link>
      <description>&lt;P&gt;Do you have your data in JMP lists, or in JMP data tables?&amp;nbsp; Can you attach samples of your data to the discussion?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 01:48:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49915#M28388</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-01-22T01:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49916#M28389</link>
      <description>&lt;P&gt;Hi kevin_c_anderso! My problem isn't necessarily finding the difference between dates, but rather that I have two lists of dates that are not connected to one another, and for one list I need the amount of time passed since the closest/most recent event on the other list. List A has more entries than List B, and there are no columns in either list that have anything I can use to join them. I just want to figure out for every item in List A, what is the most recent event in List B, and then I can calculate the amount of time that passed between them. Does that make sense?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 02:01:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49916#M28389</guid>
      <dc:creator>winslow</dc:creator>
      <dc:date>2018-01-22T02:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49917#M28390</link>
      <description>&lt;P&gt;I can't really attach the data since it is IP... But both datasets are in JMP Tables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 02:03:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49917#M28390</guid>
      <dc:creator>winslow</dc:creator>
      <dc:date>2018-01-22T02:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49919#M28392</link>
      <description>&lt;P&gt;Here are 2 data tables without keys that do a date difference.&amp;nbsp; Is this what you are looking for?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Create some sample date data tables
dtProd = New Table( "Production Data",
	Add Rows( 15 ),
	New Column( "Production Date",
		Numeric,
		"None",
		Format( "ddMonyyyy", 12 ),
		Input Format( "ddMonyyyy" ),
		Set Values(
			[3461875200, 3469737600, 3485462400, 3506630400, 3509049600, 3530217600, 3545942400, 3567110400, 3590697600,
			3606422400, 3614284800, 3651177600, 3659040000, 3666902400, 3688070400]
		)
	)
);
dtMaint = New Table( "Maintenance Data",
	Add Rows( 4 ),
	New Column( "Maintain Date",
		Numeric,
		"Continuous",
		Format( "ddMonyyyy", 12 ),
		Input Format( "ddMonyyyy" ),
		Set Values( [3444163200, 3528316800, 3603744000, 3689539200] )
	)
);

// Create a new column in the Production Data table
dtProd &amp;lt;&amp;lt; New Column( "Days since maintenance", Format( "Fixed Dec", 8,0 ) );

// Populate the new column by finding the most recent value of the Maintain Date
// that is less than the current Production Date, and then find the Difference
// in days
For( i = 1, i &amp;lt;= N Rows( dtProd ), i++,
	selectionMatrix = dtMaint &amp;lt;&amp;lt; get rows where( dtMaint:Maintain Date &amp;lt;= dtProd:Production Date[i] );
	dtProd:Days since maintenance[i] = Date Difference(
	Max( dtMaint:Maintain Date[selectionMatrix] ),dtProd:Production Date[i], "Day");
);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Jan 2018 04:20:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49919#M28392</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-01-22T04:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help! Trying to calculate time differences using two different lists of dates</title>
      <link>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49920#M28393</link>
      <description>&lt;P&gt;Yes! I think this will work! It will take me a bit to figure out how to get my tables in there (I'm a total noob at jmp :)&lt;/img&gt; ) but the principle looks right on. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2018 04:46:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Help-Trying-to-calculate-time-differences-using-two-different/m-p/49920#M28393</guid>
      <dc:creator>winslow</dc:creator>
      <dc:date>2018-01-22T04:46:44Z</dc:date>
    </item>
  </channel>
</rss>

