BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Khaladdin
Quartz | Level 8

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. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21
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

2 REPLIES 2
art297
Opal | Level 21
data want (drop=hold);
  set have;
  retain hold;
  if not missing(value) then hold=value;
  else value=hold;
run;

Art, CEO, AnalystFinder.com

 

Khaladdin
Quartz | Level 8

Many thanks.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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