BookmarkSubscribeRSS Feed
matt23
Quartz | Level 8

I want to run PROC REG hourly like in the code below:

proc sort data=matt (where=(Month in(6,7,8)));
by Month Hour;
run;

proc reg data=matt (where=(Month in(6,7,8)));
model Load=Temperature;
by Hour;
label Load="Load (MW)" Temperature="Temperature (degrees F)";
title 'Load vs Temperature (Summer)';
run;

Now, is there a way I can get out a new data out of this that records just the intercept value for every hour. Like this:

input hour intercept;

datalines;

0 1234

1 1333

2 1400

...;

3 REPLIES 3
pau13rown
Lapis Lazuli | Level 10

"ods output parameterestimates=getintercept;" https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_reg_sect051...

if that doesn't work let me know

matt23
Quartz | Level 8

Sorry, I am not a pro at SAS, Do you have an example of a code that uses this to give me an idea how to implement this?

pau13rown
Lapis Lazuli | Level 10

there was a recent post that covered ods in general: https://communities.sas.com/t5/Base-SAS-Programming/Extracting-variables-from-statistical-results-fo...

 

for your particular code it would be:

ods output parameterestimates=get_intercept (where=(parameter=''));

proc reg data=matt (where=(Month in(6,7,8)));

model Load=Temperature;

by Hour;

label Load="Load (MW)" Temperature="Temperature (degrees F)";

title 'Load vs Temperature (Summer)';

run;

 

i'm not sure about this bit: (where=(parameter='')) because i'm not sure what the variable name will be and what the text will be, maybe you want parameter='Intercept', but you'll have to look at the dataset created (called get_intercept) to see what it contains and to confirm that you have the intercept estimate for each hour

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