Hello, I have a data set like:
A B
1 11
2 12
3 13
4 0
5 0
6 0
7 0
The goal is to have SAS search for all locations of b=0 and enter instead the lag of b, draging it throughout all "0"s, to get
1 11
2 12
3 13
4 13
5 13
6 13
7 13
I'm using the code
data test1;
set test;
x=lag(b);
if b=0 then b=x;
run;
Only b in line 4 gets to be 13, not the following rows, in them b stays 0.
Any help will be appriciated. This data set is an example, we do not know how many row there are with b>0 and how many with b=0, those rows can be at the end but also in other placed in the data set. Thank you!
... View more