Desktop productivity for business analysts and programmers

Making a new data set from results.

Reply
Frequent Contributor
Posts: 89

Making a new data set from results.

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

...;

Regular Contributor
Posts: 170

Re: Making a new data set from results.

"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

--------------
blog: papersandprograms.com
Frequent Contributor
Posts: 89

Re: Making a new data set from results.

Posted in reply to PaulBrownPhD

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?

Regular Contributor
Posts: 170

Re: Making a new data set from results.

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

--------------
blog: papersandprograms.com
Ask a Question
Discussion stats
  • 3 replies
  • 86 views
  • 2 likes
  • 2 in conversation