How to Use Regression to Fill missing Values like

Solved
Occasional Contributor
Posts: 7

How to Use Regression to Fill missing Values like

[ Edited ]

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

Accepted Solutions
Solution
‎06-02-2016 05:35 AM
Super User
Posts: 23,661

Re: How to Use Regression to Fill missing Values like

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;
``````

All Replies
Super User
Posts: 23,661

Re: How to Use Regression to Fill missing Values like

I don't understand what your question is, please clarify. If you can post sample data and expected output.

Occasional Contributor
Posts: 7

Re: How to Use Regression to Fill missing Values like

[ Edited ]

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

Posts: 5,519

Re: How to Use Regression to Fill missing Values like

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.

PG
Occasional Contributor
Posts: 7

Re: How to Use Regression to Fill missing Values like

I would like to predict this missing value, How to do that ?

Solution
‎06-02-2016 05:35 AM
Super User
Posts: 23,661

Re: How to Use Regression to Fill missing Values like

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;
``````

🔒 This topic is solved and locked.