08-22-2013 02:36 AM
Hi I need to replace all missing values in a dataset with respective mean.
Find the sample i wrote.
proc means data=&dataset mean ; ;
output out=t (drop=_type_ _freq_) mean=/autoname;
proc transpose data=t out=tr;
set Tr end=last ;
if last then call symput('maxi', _n_);
/* x=left(_N_) */;
/* put _N_ maxi last x ; */;
array num(*) _numeric_;
%do n=1 %to &maxi;
if num(&n)=. then num(&n)= &&mean&n;
But this is not working..
08-22-2013 03:27 AM
Proc STANDARD will do this for you, see code sample below.
08-22-2013 05:23 AM
As stated by https://communities.sas.com/people/Murray_Court, attach a log or describe in more detail what it is that does not work...
08-22-2013 12:28 PM
Base SAS(R) 9.4 Procedures Guide (PROC standard replacing missing by mean) == Bruno-s ==
The advantage of this procedure is it is part of SAS/Base Procs
If it should be more advanced like being in the Eminer processing, That one is using
SAS/STAT(R) 12.3 User's Guide (Proc MI) .
You nee to be licnesed for that.