BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
saleh
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

 

View solution in original post

5 REPLIES 5
Reeza
Super User

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

saleh
Fluorite | Level 6

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 

PGStats
Opal | Level 21

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
saleh
Fluorite | Level 6

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

 

Thanks for your replan ....

Reeza
Super User

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;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2501 views
  • 1 like
  • 3 in conversation