Something similar to this should do it:
libname TD teradata noprompt = "< Teradata connection string>" DATABASE = MyDatabase schema = MySchema;
proc sql;
create table Want as
select A.ID1
,A.ID2
,A.Date
from TD.Have as A
inner join
(select ID1
,ID2
,max(Date) as Max_Date
from TD.Have
group by ID1
,ID2
) as B
on A.ID1 = B.ID1
and A.ID2 = B.ID2
and A.Date = B.Max_Date
;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.