How to Use Regression to Fill missing Values like this Examlpe
I have alot of missing values
but i don't want to replace it with static Value,as we can change the missing with mean and Standard Deviasion then i want to predict the Missing Value using an algorithm like Regression
simply i want to Merge First and Second code
data yourdata;
set yourdata;
array change _numeric_;
do over change;
if change=OldValue then change=newValue;
end;
run ;
Proc reg data=yourdata
Model=
Run
want to use the second Code replace the newValue
If you want to interpolate using regression you can use proc reg and get the output with the predicted value.
Here's an example using the CLASS dataset.
data class;
set sashelp.class;
if weight in (84, 112) then weight = .;
run;
proc reg data=class;
model weight = height age;
output out=want predicted=p;
run;quit;
proc print data=want;
run;
I don't understand what your question is, please clarify. If you can post sample data and expected output.
I have alot of missing values
but i don't want to replace it with static Value,as we can change the missing with mean and Standard Deviasion then i want to predict the Missing Value using an algorithm like Regression
Don't change a missing value with zero unless zero truly is the observed value. A missing value signals the absence of information and is treated appropriatly.
Note: // is not the syntax for comments in SAS code.
I would like to predict this missing value, How to do that ?
Thanks for your replan ....
If you want to interpolate using regression you can use proc reg and get the output with the predicted value.
Here's an example using the CLASS dataset.
data class;
set sashelp.class;
if weight in (84, 112) then weight = .;
run;
proc reg data=class;
model weight = height age;
output out=want predicted=p;
run;quit;
proc print data=want;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.