BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
linlin87
Quartz | Level 8

Hi SAS Forus,

 

I have a regression line and it only creates this for the x data that I have. How do I get to project beyond the x data?

 

proc sgplot data=input;
reg x=months y=change_height / clm cli;
series x=months y=change_height /group=ani markerattrs=(symbol=CircleFilled);
scatter x=months y=change_height /group=ani markerattrs=(symbol=CircleFilled);
xaxis max=20;
yaxis min=-20 max=20;
refline -10 10 / axis=y;
run;

Would this be easier to implement with proc reg?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

What @ballardw is referring to (I think) is the "Missing Response Trick", at least that's what it is called in this document (https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3337-2019.pdf) and if you scroll down to the section entitled "Scoring Data the Old-Fashioned Way", you will find code to do this.

 

Since @Rick_SAS has written blog posts on everything you might ever want to do in SAS, here's his blog post on the subject.

https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model....

--
Paige Miller

View solution in original post

3 REPLIES 3
ballardw
Super User

My approach would be to add the additional values into the base data for the independent variable(s), x axis,and missing values for the dependent variable(s), y-axis, and use an appropriate regression procedure to create predicted values and use the resulting data set to plot such extrapolated values. Recommend including the estimated confidence limits as well.

PaigeMiller
Diamond | Level 26

What @ballardw is referring to (I think) is the "Missing Response Trick", at least that's what it is called in this document (https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3337-2019.pdf) and if you scroll down to the section entitled "Scoring Data the Old-Fashioned Way", you will find code to do this.

 

Since @Rick_SAS has written blog posts on everything you might ever want to do in SAS, here's his blog post on the subject.

https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model....

--
Paige Miller
ballardw
Super User

@PaigeMiller wrote:

What @ballardw is referring to (I think) is the "Missing Response Trick", at least that's what it is called in this document (https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3337-2019.pdf) and if you scroll down to the section entitled "Scoring Data the Old-Fashioned Way", you will find code to do this.

 

Since @Rick_SAS has written blog posts on everything you might ever want to do in SAS, here's his blog post on the subject.

https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model....


Learned that back about 1986, so I guess it qualifies as "old fashioned". At least we don't really have to use Proc Plot to show results... (Really, not GPlot, not Sgplot but line-printer text based Proc Plot).

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 400 views
  • 2 likes
  • 3 in conversation