I have a dataset for repayment loan amounts it consists of the following, perm_id( firm id), startyear endyear and date as well as repayment for each month. I am trying to accumulate all repayment amounts per id per month and roll them off as the loans expire I have tried the following code; proc sql ; create table dsf2 as select a.perm_id, a.date, a.endyear, sum(b.repayment) as srepayment from dsf3 as a, dsf3 as b where a.perm_id = b.perm_id and b.date >= a.date and b.date < a.endyear group by a.perm_id, a.date, a.endyear; quit; run; However with the multiple overlapping loans it is giving very strange results Any ideas? I attempted to sum the amounts by date intervals however its picking up amounts that start later on and adds then to the very beginning.
... View more