Date: Mon, 3 May 1999 16:44:57 -0400
Reply-To: Mike Davenport <Mike.Davenport@RICHMOND.PPDI.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Mike Davenport <Mike.Davenport@RICHMOND.PPDI.COM>
Subject: Re: Interpolation imputation for missing
Content-Type: text/plain; charset=us-ascii
The formula you want is
y_i = ((y_n - y_m)*(x_i - x_m)/(x_n - x_m)) + y_m
where
y_i is the missing value to interpolate
x_i is the associated obs for y_i
y_n is the non-missing result on the upper end
x_n is the associated obs for y_n
y_m is the non-missing result on the lower end
x_m is the associated obs for y_m
Shiansong Li wrote:
> Hello, all,
>
> How to write SAS to impute missing values by linear interpolation (not
> locf).
>
> Data itpltn;
> obs value;
> 1 6
> 2 .
> 3 .
> 4 12
> 5 .
> 6 11
>
> The output data set should be like this:
> obs value;
> 1 6
> 2 8
> 3 10
> 4 12
> 5 11.5
> 6 11
>
> Thanks in advance.
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
|