From: Al on

All:

I have the data set in the following structure

site pat week
13 10 0
2
3
4
14 10 0
2
3
4
15 11 0
2
3


I have spead sheet (100K records).. i have imported this spread sheet
in to SAS dataset ..
i want to retain the the site and pat values to the consecutive
observation .. how can it be accomplished

The output should look like

site pat week
13 10 0
13 10 2
13 10 3
13 10 4
14 10 0
14 10 2
14 10 3
14 10 4
15 11 0
15 11 2
15 11 3



Any suugestions .. Thanks in advance

Al
From: Richard A. DeVenezia on
On May 14, 2:47 pm, Al <ali6...(a)gmail.com> wrote:
> All:
>
> I have the data set in the following structure
>
> site  pat  week
> 13    10    0
>                2
>                3
>                4
> 14    10    0
>                2
>                3
>                4
> 15    11    0
>                2
>                3
>
> I have  spead sheet (100K records).. i have imported this spread sheet
> in to SAS dataset ..
> i want to retain the the site and pat values to the consecutive
> observation .. how can it be accomplished
>
> The output should look like
>
> site pat week
> 13   10   0
> 13   10   2
> 13   10   3
> 13   10   4
> 14   10   0
> 14   10   2
> 14   10   3
> 14   10   4
> 15   11   0
> 15   11   2
> 15   11   3
>
> Any suugestions .. Thanks in advance

Al:

You can use a RETAIN statement and conditionally assign the value that
will be used to fill in the missings.

---------------------------------
data have;
input site pat week;
datalines;
13 10 0
. . 2
. . 3
. . 4
14 10 0
. . 2
. . 3
. . 4
15 11 0
. . 2
. . 3
run;

data want;
set have;
retain fillsite fillpat;
if site ne . then fillsite = site; else site = fillsite;
if pat ne . then fillpat = pat; else pat = fillpat;
drop fill:;
run;
---------------------------------

Richard A. DeVenezia
http://www.devenezia.com