Dear SAS Experts, Need your help in figuring out how to compare dates in 2 datasets having same ID for multiple observations and selecting the latest as I am bit new to SAS and still learning Table 1 has 3 columns ID No Date 1 1 4-Apr-18 1 2 19-May-18 1 3 20-Jul-18 1 4 01-Aug-18 ' Table 2 has 3 columns ID No Date 1 1 2-May-18 1 2 10-Jun-18 1 3 15-Jul-18 For every record in table1 with the same ID , i need to compare the date with table2 having same ID and ensure t1.date >=t2.date. If there multiple records satisfying the condition from table 2 then take the latest and create a column valid with values Y or N, if condition not satisfied e.g. for record 3 in table1 for ID=1 all the records from table2 satisfy the t1.date >=t2.date. in this case i have to pick the 15-jul-18 against that record. and put valid flag as Y Thanks for all the help in advance.
... View more