11-13-2014 07:35 PM
I have a huge data with a lot of missing values for a variable. For example,
input x y;
Now I want to fill in the missing y with its lagged value. That is, for x=1, y=0 for the missing ones and x=2, y=9 for the last two observations. But when I use lag function, it only fills in the first missing observation.
Can anyone please tell me how to do this? Please note, the data is large. So it's better to avoid open/close data too many times.
11-14-2014 01:55 AM
The lag function in SAS is a queue functionality and is quite different then the lag en lead functions in Oracle / MS-Sql
For not getting confused avoid using that same name for that.
What you are possible trying to do is known as "impute missings" as that is part of the mining steps.
Just putting in the previous value is not the best strategy to do that, there are several more approaches .
Need further help from the community? Please ask a new question.