Hi everyone. I need to fill in the next default date as shown in the attachment. The desired output is the last column. The language used is SAS. Thxs

Viewed 21

I am trying to fill in the next default date for the customer_nr and account_nr combination. The objective is to have the default date filled until default flag = 1 and then next default date afterwards. Only the last default date will be dragged downward.

enter image description here

1 Answers

Use SAS RETAIN statement. I assume you also want it to not cross over customer number so I reset it when the customer number changes.

data want;
set have;
by customer_nr;
retain default_date_needed_forward;
    if first.customer_nr then call missing(default_date_needed_forward);
    if not missing(default_date) then default_date_needed_forward = default_date;
run;
Related