Try this data have;
do id=1 to 10;
balance=id*.452;
create_dt=mdy(id,1,2018);
output;
if id>=7 then do;
balance=id*.458;
create_dt=mdy(id,1,2019);
output;
end;
end;
format create_dt date9.;
run;
/* This will yield the same result */
proc sql;
create table want as
select
id,
balance,
max(create_dt) as max_crdt format=date9.
from have
group by id;
quit;
/* I think this is what you want */
proc sql;
create table want as
select
id,
balance,
create_dt
from have
group by id
having max(create_dt)=create_dt;
quit;
... View more