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

Hi there,

I have a data set as the picture shows below. For variable R, it has a lot of missing values. What I want to do is to assign the existing value to all the previous blanks. For example, assign 1.0219 to observation 1-10 of R, and assign 0.9598 to observations 12 to 20. Finally the variable R will have 0 missing values. Any ideas?

TIA!

A.jpgA

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

OK.

data have ;
input a b;
cards;
1 .
2 .
3 4
4 5
5 .
6 .
7 .
8 9
;
run;
data want;
do until(not missing(b));
 set have;
end;
c=b;
do until(not missing(b));
 set have; output;
end;
run;


Ksharp

View solution in original post

2 REPLIES 2
Ksharp
Super User

OK.

data have ;
input a b;
cards;
1 .
2 .
3 4
4 5
5 .
6 .
7 .
8 9
;
run;
data want;
do until(not missing(b));
 set have;
end;
c=b;
do until(not missing(b));
 set have; output;
end;
run;


Ksharp

PeterPanPan
Calcite | Level 5

Thank you so much, Ksharp, you solved my problem!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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