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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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