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;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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