Hi Ksharp, For Cust_No A with Number 3, the expected maturity date should be 28-Nov-2016 (instead of missing) as this is a distinct transaction. Need your advice on the followings:- 1). Is it possible to us lag function and do looping to perform the task ? example :- Uniqkey=cats(Cus_No,Amount); Data Want; Set Have; by uniqkey; if first.unikey then do; issue_date1=Issue_date; Differ=0; Do i=2 to _N_; do j=i-1 to 1; if (lagj(differ)=0 or lagj(differ)=1)and (issue_Date-lagj(maturity_Date) = 1 or issue_Date-lagj(maturity_Date)= 0) then do; issue_date1=lagj(Issue_date); Differ=issue_Date-lagj(maturity_Date); return; end; end; end; Run; 2). Presume the roll over transactions is 3, then i have to create 3 data sets to perform the task? Thanks for your help.
... View more