Fill NA values with first non-NA value
Posted: Wed Jul 06, 2011 9:41 am
Hi,
I have a series that has NAs for the first, say, 20 periods and then non-na values. How do I "fill" the NAs up to the first non-na value with the first non-na value?
If the NAs were located at the end of the series, x=@recode(x=na,x(-1),x) works but I can't manage to work a variation of this expression for the question above.
Could you please help?
Thanks,
Javier
I have a series that has NAs for the first, say, 20 periods and then non-na values. How do I "fill" the NAs up to the first non-na value with the first non-na value?
If the NAs were located at the end of the series, x=@recode(x=na,x(-1),x) works but I can't manage to work a variation of this expression for the question above.
Could you please help?
Thanks,
Javier