## Assign Values for Missings

Solved
Occasional Contributor
Posts: 7

# Assign Values for Missings

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

Accepted Solutions
Solution
‎05-15-2013 01:08 AM
Super User
Posts: 10,784

## Re: Assign Values for Missings

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

All Replies
Solution
‎05-15-2013 01:08 AM
Super User
Posts: 10,784

## Re: Assign Values for Missings

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

Occasional Contributor
Posts: 7

## Re: Assign Values for Missings

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

🔒 This topic is solved and locked.