I believe the
Tables=>Join will do what you want.
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.
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 << 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 << New Column( "Date Diff in Days", formula( Abs( :Test A Date - :Test B Date ) / In Days( 1 ) ) );
dtFinal << select where(:Date Diff in Days > 90 );
Jim