That is want is called Last Observation Carried Forward (LOCF).
For that data a simple retained variable will work. Note that the retained variable needs to be a NEW variable (not one already in the source dataset) otherwise the retained value is overwritten when the next observation is read.
data have;
input Source Output;
cards;
1 1
1 1
1 1
2 2
2 2
. 2
. 2
. 2
4 4
;
data want;
set have;
want = coalesce(source,want);
retain want;
run;
Result
Obs Source Output want
1 1 1 1
2 1 1 1
3 1 1 1
4 2 2 2
5 2 2 2
6 . 2 2
7 . 2 2
8 . 2 2
9 4 4 4