Hi All, I am trying to join two tables together, the first has a list of accounts(a) and the second has a list of associated merchants(b). As each account may be associated with the same merchant more than once, I would like to return a final table with distinct account numbers based on the min of the first date and max of last date fields in the associated merchant table. Have for a single account: a.ID_Key, a.EntryDate a.AccountNumber, 123 03JAN19:00:00:00 5678 b.Merch_ID_Key b.Entry_Date b.First_Merch_Date b.Last_Merch_Date 123 03JAN19:00:00:00 21OCT18:00:00:00 22DEC18:00:00:00 123 03JAN19:00:00:00 01MAR16:00:00:00 20SEP17:00:00:00 Want: a.ID_Key, a.EntryDate a.AccountNumber, b.First_Merch_Date b.Last_Merch_Date 123 03JAN19:00:00:00 5678 01MAR16:00:00:00 22DEC18:00:00:00 My output is giving me the correct amount of rows but the dates are coming back as "*******" Here is my query: proc sql;
create table MerchAcct as
select a.ID_Key, a.EntryDate, a.AccountNumber,
min(b.First_Merch_Date) as First_Merch_Date format date9.,
max(b.Last_Merch_Date) as Last_Merch_Date format date9.
from Accounts a
join Merch b
on a.ID_Key=b.ID_Key
and a.EntryDate=b.EntryDate
group by a.ID_Key, a.EntryDate, a. AccountNumber;
quit; As a reference I am using SAS EG.
... View more