proc sort data=have;
by customeraccount date;
run;
data want;
set have;
by CustomerAccount;
if InterestRate -lag(interestrate) ne 0;
run;
proc sql;
select max(date) as date format= ddmmyy10., customeraccount,
max(previousrate) as previousrate, max(newrate) as newrate from
(select max(date) as date format =ddmmyy10., customeraccount,
case when date =min(date) then interestrate end as previousrate,
case when date =max(date) then interestrate end as newrate
from want
group by customeraccount)
group by customeraccount;
something like this
... View more