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

I have a SGPLOT and I would like to include some regression info on the SGPLOT. I have seen some examples online that include slope R-squared or RMSE. I have a code for SGPLOT and REG separately but I don't know how to display info from PROC REG on the SGPLOT.

 

Here's what I have:

proc sgplot data=have; 
where Month in (6,7,8)
           and Weekday in (1,2,3,4,5) 
           and hour in (4, 17);
scatter x=Temperature y=Load / group=hour;
title '5 P.M. vs 4 A.M. Load vs Temperature(summer)';
run; 
proc reg data=have;
where Month in (6,7,8);
where also Hour in (4);
where also Weekday in (1,2,3,4,5);
model Load = Temperature;
title 'Weekday Regression at 4 AM';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Extract them to a data set, add them to your master data set and use MARKER or TEXT to plot them on the graph. 

https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html

 

If you search on here I'm 99% sure there are examples.

 


@matt23 wrote:

I have a SGPLOT and I would like to include some regression info on the SGPLOT. I have seen some examples online that include slope R-squared or RMSE. I have a code for SGPLOT and REG separately but I don't know how to display info from PROC REG on the SGPLOT.

 

Here's what I have:

proc sgplot data=have; 
where Month in (6,7,8)
           and Weekday in (1,2,3,4,5) 
           and hour in (4, 17);
scatter x=Temperature y=Load / group=hour;
title '5 P.M. vs 4 A.M. Load vs Temperature(summer)';
run; 
proc reg data=have;
where Month in (6,7,8);
where also Hour in (4);
where also Weekday in (1,2,3,4,5);
model Load = Temperature;
title 'Weekday Regression at 4 AM';
run;

 

 

View solution in original post

2 REPLIES 2
Reeza
Super User

Extract them to a data set, add them to your master data set and use MARKER or TEXT to plot them on the graph. 

https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html

 

If you search on here I'm 99% sure there are examples.

 


@matt23 wrote:

I have a SGPLOT and I would like to include some regression info on the SGPLOT. I have seen some examples online that include slope R-squared or RMSE. I have a code for SGPLOT and REG separately but I don't know how to display info from PROC REG on the SGPLOT.

 

Here's what I have:

proc sgplot data=have; 
where Month in (6,7,8)
           and Weekday in (1,2,3,4,5) 
           and hour in (4, 17);
scatter x=Temperature y=Load / group=hour;
title '5 P.M. vs 4 A.M. Load vs Temperature(summer)';
run; 
proc reg data=have;
where Month in (6,7,8);
where also Hour in (4);
where also Weekday in (1,2,3,4,5);
model Load = Temperature;
title 'Weekday Regression at 4 AM';
run;

 

 

TomKari
Onyx | Level 15

Here's a link to a bunch of SAS suggestions for people using regression; you might find them useful.

 

Take a look at Number 26 in terms of your question.

 

Tom

 

http://iainpardoe.com/arm2e/sas-code/

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 935 views
  • 0 likes
  • 3 in conversation