Date: Thu, 7 May 1998 09:44:55 -0400 Mike Davenport "SAS(r) Discussion" Mike Davenport Re: missing data imputation programs in SAS To: Lynn.Foster-Johnson@Dartmouth.EDU text/plain; charset=us-ascii

here is some code that will do any number of linear imputations as long a the endpoints are non-missing. This is just using the slope= delta y/ delta x method

this is not necessarly the most efficient way, but it does work

but no guarantee's are provided

mike

*****************************; *** linear imputation ***; *****************************;

data imp; array v {*} v1-v20; array vh {*} vh1-vh20; array x {*} x1-x20; set old; do i=1 to dim(v); if i ne 1 and i ne hbound(v) then do;

****** impute any nubmer of missing values **********;

if v(i)=. then do; k=i;done=0; do j=k+1 to dim(v) while (not done); if j= hbound(v) then do;q=0;i=j;done=1;end; if v(j) ^= . then do;q=j-1;i=j;done=1;end; end; if q ^in (0,1) then do m=k to q; vh(m)=(((v(q+1)-v(k-1))*(x(m)-x(k-1)))/(x(q+1)-x(k-1)))+v(k-1);

end; end;

*******************************************************;

end;

*** do not impute first, last, non-missing values ***;

if i=1 or i=hbound(v) or v{i} ne . then vh{i}=v{i}; end; drop i; run;

Lynn Foster-Johnson wrote:

> I'm interested in any SAS macros or programs that are available for > missing data imputation. Does anyone have any information about this? > I seem to remember that there were several papers at a recent SUGI, but > don't remember where I saw this. Any info would be helpful. > > TIA; > > Lynn > -- > Lynn Foster-Johnson, Ph.D. > Research Statistician > Amos Tuck School of Business > Dartmouth College > 100 Tuck Hall, HB 9006 > Hanover, NH 03755

Back to: Top of message | Previous page | Main SAS-L page