Hi Everyone,
My data has ID, Key_Value, v1,v2,v3.
In the data, when Key_value ^=. , at least 1 of v1,v2,v3 will have value.
I want to fill all missing value of v1, v2, v3 with the corresponding value associated with the most recent available Key_value.
The tricky part is that retain will fill value all the way until it reach non-missing value of the same column (instead of the Key_value column).
The first few rows desirable output should look like where for V2 =3 only fills up to 3rd record.
Can you please help?
Many thanks,
HHC
1 . . . .
1 6 5 3 .
1 . 5 3 .
1 7 8 . ./*No fill of value 3 here as Key_value contain non-missing*/
1 . 8 . .
Input file
data have;
input id key_value v1 v2 v3;
datalines;
1 . . . .
1 6 5 3 .
1 . . . .
1 7 8 . .
1 . . . .
2 9 . . 9
2 . . . .
2 1 . 7 .
2 . . . .
;
... View more