data a;
input cust_id period x1 x2 x3;
cards;
1 1 1000 3 3
1 2 1000 5 2
1 3 1000 6 4
1 4 1000 7 6
1 5 1000 3 2
2 1 2000 6 5
2 2 2000 4 6
2 3 2000 3 1
;
run;
proc sort data=a;
by cust_id period;
run;
data b;
set a;
by cust_id period;
x2_=lag(x2);
if first.cust_id then do; y=x1; x2_=.; end;
else y=x3*x2_;
run;