I want to combine 2 data-frames together using the following databases (1) & (2). Desired result is shown in (3).
1)
Case Date
123 2019-12-21
123 2019-12-16
234 2019-12-21
345 2019-12-21
2)
Case Date Value
123 2019-12-20 0.4
123 2019-12-18 0.5
123 2019-12-14 1.2
3) Final
Case Date_X Date_Y Value
123 2019-12-21 2019-12-20 0.4
123 2019-12-16 2019-12-14 1.2
234 2019-12-21
345 2019-12-21
Below are the criteria that I am looking for:
1.) match based on 'case'.
2.) 'Date_Y' must be =< 'Date_X' and it must be the maximum date in the data-frame of 'case'.
3.) Display value that is corresponding to Date_Y.
I tried looking for similar codes but I could not find it.
Thank you in advance for helping.