08-10-2016 10:52 AM
I'd really appreciate help with this question if anyone has any suggestions.
I have a dataset that looks like this --
date Series1 Series2
1980 . 20
1981 . .
1982 10 15
1983 30 .
1984 25 19
1985 27 22
1986 . 25
1987 . 23
I want to be able to do the following --
a. Replace the two missing values (with zeros) for Series 2 for the years 1981 and 1983 (zero is a valid value for embedded missing values).
b. Replace the two missing values (with zeros) at the end for 1986 and 1987 for Series 1.
But, I DON'T want to replace the missing values for 1980 and 1981 for Series 1 since the series was yet to begin then (so, a zero would not be a valid value).
I've tried using Proc Expand to do it and here's the code --
Proc Expand data =year_ds out = year_ds1;
convert series1 series2 / Transformin = (Setmiss 0);
The documentation says that Proc Expand only replaces embedded missing values i.e., it doesn't change beginning and ending missing values. So, the code above should only replace the embedded missing values for Series 2 (so, it shouldn't change the beginning and ending values for Series 1) but from what I'm seeing, the beginning and ending values (for Series 1) are being replaced with 0s as well -- so, all missing values in Series 1 and 2 are being replaced with 0s.
Any ideas would be greatly appreciated!
Need further help from the community? Please ask a new question.