Is there a way to replace multiple missing values in a column with the previous non-misisng value?
Here is what a sample dataset would look like:
I would like to find a way to replace all the missing values with the non-missing value above it all the way down to the next non-missing value. The updated data would hopefully look like:
ProjectID Action UserID
Project1 Started User1
Project1 Update1 User1
Project1 Update2 User1
Project1 Update3 User1
Project1 Update4 User1
Project1 Update5 User2
Project1 Update6 User2
Project1 Update7 User2
Project1 Update8 User1
I've tried some things with the retain statement, but I'm not having any luck. Does anyone have any ideas on how I might accomplish this?
~Dave
Here is what a sample dataset would look like:
Code:
data have;
input ProjectID $ Action $ UserID $;
datalines;
Project1 Started User1
Project1 Update1 User1
Project1 Update2 .
Project1 Update3 .
Project1 Update4 User1
Project1 Update5 User2
Project1 Update6 .
Project1 Update7 .
Project1 Update8 User1
;
run;
I would like to find a way to replace all the missing values with the non-missing value above it all the way down to the next non-missing value. The updated data would hopefully look like:
ProjectID Action UserID
Project1 Started User1
Project1 Update1 User1
Project1 Update2 User1
Project1 Update3 User1
Project1 Update4 User1
Project1 Update5 User2
Project1 Update6 User2
Project1 Update7 User2
Project1 Update8 User1
I've tried some things with the retain statement, but I'm not having any luck. Does anyone have any ideas on how I might accomplish this?
~Dave