<?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: date differences in two datasets in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682714#M86827</link>
    <description>&lt;P&gt;I have also written an add-in which could be used for this (it is clunky to use and automating it might be a bit difficult, but it should be possible). &lt;LI-MESSAGE title="Join Nearest Rows - Join tables by using continuous columns and nearest values" uid="460321" url="https://community.jmp.com/t5/JMP-Add-Ins/Join-Nearest-Rows-Join-tables-by-using-continuous-columns-and/m-p/460321#U460321" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt; . I hope that I have time to rewrite this at some point&lt;/P&gt;
&lt;P&gt;Tolerance is set to 7776000 as JMP datetimes are in seconds. Join direction is Nearest as we can join backwards or forwards&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1696054369216.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57128iCD2E0DD218942E9A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1696054369216.png" alt="jthi_0-1696054369216.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and from result you can remove extra rows with no matches&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1696054423776.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57129i858535254D604A76/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1696054423776.png" alt="jthi_1-1696054423776.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;After some cleanup&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1696054577787.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57130i89946C623DEB7D8F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1696054577787.png" alt="jthi_2-1696054577787.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you know SQL you could use that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Query(
	Table(dt1, "dt1"),
	Table(dt2, "dt2"), 
	"\[SELECT dt1.*, dt2."Test B Date", Abs(dt1."Test A Date" - dt2."Test B Date") / (24*60*60) DeltaDays
		FROM dt1
		join dt2 on dt1.subject = dt2.subject
		where
			Abs(dt1."Test A Date" - dt2."Test B Date") &amp;lt;= 90*24*60*60
	]\"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But in this case I think using JMP's interactive solution and taking the script JMP creates for you (join by subject, add new column based on date differences (right click menu can do this), add second column to check if the difference is small enough, perform selection based on that and remove extra rows). Both &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; and &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/1701"&gt;@dale_lehman&lt;/a&gt; did more or less suggest this&lt;/P&gt;
&lt;P&gt;Join:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1696055513159.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57131iD2204B89B549FAAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1696055513159.png" alt="jthi_3-1696055513159.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Adding first cormula column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_4-1696055545288.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57132iA774F3FC528DC98D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_4-1696055545288.png" alt="jthi_4-1696055545288.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Adding second formula&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_5-1696055640618.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57133iD66A93ED17C1224A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_5-1696055640618.png" alt="jthi_5-1696055640618.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Select 0 rows and delete those&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_6-1696055666118.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57134iAE0202BE0E7C6248/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_6-1696055666118.png" alt="jthi_6-1696055666118.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Final result&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_8-1696055713523.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57136iAB0BC16AA92BBF38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_8-1696055713523.png" alt="jthi_8-1696055713523.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;JMP created script (this should be cleaned up a bit, good post regarding that &lt;LI-MESSAGE title="Better JSL Smoother Migration: How To Fix Your Own Code​" uid="537424" url="https://community.jmp.com/t5/Learning-Center/Better-JSL-Smoother-Migration-How-To-Fix-Your-Own-Code/m-p/537424#U537424" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_7-1696055708813.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57135i62B88A72B82DDD59/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_7-1696055708813.png" alt="jthi_7-1696055708813.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 30 Sep 2023 06:41:10 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2023-09-30T06:41:10Z</dc:date>
    <item>
      <title>date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682526#M86805</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two datasets on a cohort of patients.&amp;nbsp; One has dates of test “a” and the other has dates of test “b”.&amp;nbsp; the number of tests a and b on a subject vary (i.e., some have a lot of a and few b or visa versa)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to find all instances where tests a and b are within a timeframe (90 days for this project).&amp;nbsp; How could I automate the comparison of all combinations of test a and b to find the tests within this parameter?&amp;nbsp; Stated differently, how do I compare every test a date against all test b dates to caculate a date difference (and isolate those &amp;lt;90d)?&amp;nbsp; if I just get a list of all the date-diff combinations I can easily sort to find those &amp;lt;90d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;DATASET1&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Subject #&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test A date&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp; 1/1/23&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;&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;&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;&amp;nbsp;&amp;nbsp; 2/1/23&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;&amp;nbsp;&amp;nbsp; 3/1/23&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;&amp;nbsp;&amp;nbsp; 4/1/23&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;&amp;nbsp;&amp;nbsp; 2/1/10&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;&amp;nbsp;&amp;nbsp; 5/1/10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;DATASET2&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Subject #&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test B date&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;&amp;nbsp;&amp;nbsp; 1/1/14&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;&amp;nbsp;&amp;nbsp; 6/1/23&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;&amp;nbsp;&amp;nbsp; 11/1/22&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;&amp;nbsp;&amp;nbsp; 1/1/10&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;&amp;nbsp;&amp;nbsp; 1/1/23&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;&amp;nbsp;&amp;nbsp; 1/5/23&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;RESULTS&lt;/U&gt;&lt;BR /&gt;subject&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test a date &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test b date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date diff&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp; 1/1/23&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11/1/22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 60d&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;&amp;nbsp;&amp;nbsp; 3/1/23&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/1/23&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 90d&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;&amp;nbsp;&amp;nbsp; 2/1/10&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/1/10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 18:22:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682526#M86805</guid>
      <dc:creator>jsolo01</dc:creator>
      <dc:date>2023-09-29T18:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682590#M86808</link>
      <description>&lt;P&gt;I would try joining the data sets by subject, and then using the datedifference function to calculate the differences between tests A and tests B.&amp;nbsp; It is a little unclear to me whether you want all of the differences for all pairs of tests or just the minimum or maximum difference.&amp;nbsp; If the minimum or maximum, you should be able to create new columns for the earliest and/or latest dates for tests A and B before calculating the date difference.&amp;nbsp; If you want all the differences, then you may need to restructure your data set (perhaps by stacking the test A and test B columns after joining the datasets) before calculating the date differences.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 19:37:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682590#M86808</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2023-09-29T19:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682593#M86809</link>
      <description>&lt;P&gt;Attached are the 3 data sets for your example above.&amp;nbsp; I'm not sure what you mean by your Results table - there are more matches than you are showing.&amp;nbsp; So, if it is an abbreviated from of what I attached, then this should work for you.&amp;nbsp; If you really only wanted those 3 matches and differences shown in your Results, then I'm not understanding how you are choosing which matches you want.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 19:47:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682593#M86809</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2023-09-29T19:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682608#M86810</link>
      <description>&lt;P&gt;I believe the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Tables=&amp;gt;Join will do what you want.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1696017593695.png" style="width: 735px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57114iFAF5438627783D0F/image-dimensions/735x490?v=v2" width="735" height="490" role="button" title="txnelson_0-1696017593695.png" alt="txnelson_0-1696017593695.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a script that creates your 2 sample tables, and then Joins them together and highlights all of the rows with date differences greater than 90.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = New Table( "Dataset1",
	Add Rows( 6 ),
	New Column( "Subject",
		Character,
		"Nominal",
		Set Property( "Value Order", {Numerical Order( 0 )} ),
		Set Values( {"1", "1", "1", "1", "2", "2"} )
	),
	New Column( "Test A Date",
		Numeric,
		"Nominal",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Set Property( "Value Order", {Numerical Order( 0 )} ),
		Set Selected,
		Set Values( [3755376000, 3758054400, 3760473600, 3763152000, 3347827200, 3355516800] )
	)
);
dt2 = New Table( "Dataset2",
	Add Rows( 6 ),
	New Column( "Subject",
		Character,
		"Nominal",
		Set Property( "Value Order", {Numerical Order( 0 )} ),
		Set Values( {"1", "1", "1", "2", "2", "2"} )
	),
	New Column( "Test B Date",
		Numeric,
		"Nominal",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Set Property( "Value Order", {Numerical Order( 0 )} ),
		Set Selected,
		Set Values( [3471379200, 3768422400, 3750105600, 3345148800, 3755376000, 3755721600] )
	),
	Set Row States( [1, 0, 0, 0, 0, 0] )
);


// The code below is the code that does the work.  
dtFinal = dt1 &amp;lt;&amp;lt; Join(
	With( dt2 ),
	Merge Same Name Columns,
	Match Flag( 0 ),
	By Matching Columns( :Subject = :Subject ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 0, 0 ),
	Preserve main table order( 1 ),
	Output Table( "Final" )
);

dtFinal &amp;lt;&amp;lt; New Column( "Date Diff in Days", formula( Abs( :Test A Date - :Test B Date ) / In Days( 1 ) ) );

dtFinal &amp;lt;&amp;lt; select where(:Date Diff in Days &amp;gt; 90 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 20:01:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682608#M86810</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-09-29T20:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682615#M86811</link>
      <description>&lt;P&gt;I got the same thing as you, except for 2 items:&amp;nbsp; I calculated the difference in months rather than days (an oversight - days makes more sense), and you used the absolute value of the difference.&amp;nbsp; That factor is unclear from the request - I would normally think of the tests as sequential (A preceding B), but given that a number of the B tests preceded the A tests, I guess the absolute value makes more sense.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 20:14:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682615#M86811</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2023-09-29T20:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682639#M86814</link>
      <description>&lt;P&gt;my goal is to isolate subjects to include in a study who have tests a and b done within 90 days of each other.&amp;nbsp; My results only lists the pair of tests with &amp;lt;=90d in between as that would be the desired result.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 20:40:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682639#M86814</guid>
      <dc:creator>jsolo01</dc:creator>
      <dc:date>2023-09-29T20:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682656#M86818</link>
      <description>&lt;P&gt;So either my solution or txnelson's will work (he's the coding wizard, I just use my mouse).&amp;nbsp; Once you have the date differences calculated just choose those &amp;lt; 90 days or create a column identifying those &amp;lt;90 with an indicator (e.g., 1 vs 0).&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 21:44:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682656#M86818</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2023-09-29T21:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: date differences in two datasets</title>
      <link>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682714#M86827</link>
      <description>&lt;P&gt;I have also written an add-in which could be used for this (it is clunky to use and automating it might be a bit difficult, but it should be possible). &lt;LI-MESSAGE title="Join Nearest Rows - Join tables by using continuous columns and nearest values" uid="460321" url="https://community.jmp.com/t5/JMP-Add-Ins/Join-Nearest-Rows-Join-tables-by-using-continuous-columns-and/m-p/460321#U460321" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt; . I hope that I have time to rewrite this at some point&lt;/P&gt;
&lt;P&gt;Tolerance is set to 7776000 as JMP datetimes are in seconds. Join direction is Nearest as we can join backwards or forwards&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1696054369216.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57128iCD2E0DD218942E9A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1696054369216.png" alt="jthi_0-1696054369216.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and from result you can remove extra rows with no matches&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1696054423776.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57129i858535254D604A76/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1696054423776.png" alt="jthi_1-1696054423776.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;After some cleanup&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1696054577787.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57130i89946C623DEB7D8F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1696054577787.png" alt="jthi_2-1696054577787.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you know SQL you could use that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Query(
	Table(dt1, "dt1"),
	Table(dt2, "dt2"), 
	"\[SELECT dt1.*, dt2."Test B Date", Abs(dt1."Test A Date" - dt2."Test B Date") / (24*60*60) DeltaDays
		FROM dt1
		join dt2 on dt1.subject = dt2.subject
		where
			Abs(dt1."Test A Date" - dt2."Test B Date") &amp;lt;= 90*24*60*60
	]\"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But in this case I think using JMP's interactive solution and taking the script JMP creates for you (join by subject, add new column based on date differences (right click menu can do this), add second column to check if the difference is small enough, perform selection based on that and remove extra rows). Both &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt; and &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/1701"&gt;@dale_lehman&lt;/a&gt; did more or less suggest this&lt;/P&gt;
&lt;P&gt;Join:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1696055513159.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57131iD2204B89B549FAAF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1696055513159.png" alt="jthi_3-1696055513159.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Adding first cormula column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_4-1696055545288.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57132iA774F3FC528DC98D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_4-1696055545288.png" alt="jthi_4-1696055545288.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Adding second formula&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_5-1696055640618.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57133iD66A93ED17C1224A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_5-1696055640618.png" alt="jthi_5-1696055640618.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Select 0 rows and delete those&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_6-1696055666118.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57134iAE0202BE0E7C6248/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_6-1696055666118.png" alt="jthi_6-1696055666118.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Final result&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_8-1696055713523.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57136iAB0BC16AA92BBF38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_8-1696055713523.png" alt="jthi_8-1696055713523.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;JMP created script (this should be cleaned up a bit, good post regarding that &lt;LI-MESSAGE title="Better JSL Smoother Migration: How To Fix Your Own Code​" uid="537424" url="https://community.jmp.com/t5/Learning-Center/Better-JSL-Smoother-Migration-How-To-Fix-Your-Own-Code/m-p/537424#U537424" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_7-1696055708813.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/57135i62B88A72B82DDD59/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_7-1696055708813.png" alt="jthi_7-1696055708813.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 06:41:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/date-differences-in-two-datasets/m-p/682714#M86827</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-09-30T06:41:10Z</dc:date>
    </item>
  </channel>
</rss>

