Hello, I would like to replace value in the amount with last observation amount value when only the description is "r" or "ra" within same account. Could you please help me how to do that ? Thank you so much ! data have; infile datalines delimiter=','; input account description $ amount; datalines; 123,a,0 123,a,0 123,r,1 /**<- replace with last value (30) when "r" or "ra" */ 123,r,20 /**<- replace with last value (30) when "r" or "ra" */ 123,ra,30 123,w,4 234,b,1 234,c,20 234,ra,400 /**<- replace with last value (200) when "r" or "ra" */ 234,r,200 234,c,200 ; run; data want; infile datalines delimiter=','; input account description $ amount; datalines; 123,a,0 123,a,0 123,r,30 123,r,30 123,ra,30 123,w,4 234,b,1 234,c,20 234,ra,200 234,r,200 234,c,200 ; run;
... View more