Just to elaborate a bit on the code posted by @Astounding and formatting it:
data work.table_1;
input br value;
datalines;
1 7184
0 9759
1 9988
0 6780
0 6398
1 7107
0 5776
0 3719
;
run;
* _id is a temp variable which stores the latest value where br is 1;
data work.table_2(drop=_id);
length id 8.;
set work.table_1;
if br=1 then
_id = value;
* _N_ contains the current iteration number;
if _N_ > 1 then
id = _id;
* retains the value from iteration to iteration;
retain _id;
run;
... View more