Community talk about communities.sas.com. Meta!

SAS_Missing observations

Accepted Solution Solved
Reply
Contributor
Posts: 33
Accepted Solution

SAS_Missing observations

[ Edited ]

Hi all,

 

I have a question. I want to ask my question as an example. I have the following datasets:

 

        AAA              Value

          1                    25

          2                     .

          3                     .

          4                    22

          5                     .

 

As you can see, there are some missing observations in column VALUE. I want to equalize this missing value to previous observations. So, the result should be:

 

        AAA              Value

          1                    25

          2                    25 ( because the previous number is 25)

          3                    25 ( because the previous number is 25)

          4                    22

          5                    22 ( because the previous number is 22)

 

Many thanks in advance. 

 


Accepted Solutions
Solution
‎03-26-2017 12:09 PM
PROC Star
Posts: 7,364

Re: SAS_Missing observations

data want (drop=hold);
  set have;
  retain hold;
  if not missing(value) then hold=value;
  else value=hold;
run;

Art, CEO, AnalystFinder.com

 

View solution in original post


All Replies
Solution
‎03-26-2017 12:09 PM
PROC Star
Posts: 7,364

Re: SAS_Missing observations

data want (drop=hold);
  set have;
  retain hold;
  if not missing(value) then hold=value;
  else value=hold;
run;

Art, CEO, AnalystFinder.com

 

Contributor
Posts: 33

Re: SAS_Missing observations

Many thanks.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 249 views
  • 2 likes
  • 2 in conversation