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

Hi, I need help getting something similar to this:

Screen Shot 2018-06-26 at 12.05.33 PM.png

 

Here's a tiny bit of my data:

YearMonthDayHourLoadTemperature
20091107023220.87
20091116842220.61
20091126701420.27
20091136606820.52
20091146578121.45
20091156630821.69
20091166755921.87
20091176915022.39

Y = Load , X = Temp

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You can't have a correlation or slope with only a single or even two observations, so it's a moving statistics of some kind. You need to define the window. 

 Depending on the window and exact calculations I'd probably recommend either an array approach or PROC EXPAND.

 

Here's the PROC EXPAND documentation:

 

http://documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_expand_examples04.htm&docsetVersion=...

 

Available transformations:

http://documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_expand_details19.htm&docsetVersion=1...

 

Otherwise, an array.

http://support.sas.com/kb/25/027.html

 

You'll likely need to write the formula for the slope/intercept either way, by determining the formulas/components and doing the calculation.

View solution in original post

9 REPLIES 9
Reeza
Super User

What are your definitions of slope and correlation here?

Do you have SAS/ETS licenced?

You can check with:

proc product_status;run;

@matt23 wrote:

Hi, I need help getting something similar to this:

Screen Shot 2018-06-26 at 12.05.33 PM.png

 

Here's a tiny bit of my data:

Year Month Day Hour Load Temperature
2009 1 1 0 70232 20.87
2009 1 1 1 68422 20.61
2009 1 1 2 67014 20.27
2009 1 1 3 66068 20.52
2009 1 1 4 65781 21.45
2009 1 1 5 66308 21.69
2009 1 1 6 67559 21.87
2009 1 1 7 69150 22.39

Y = Load , X = Temp


 

matt23
Quartz | Level 8

Actually working on 9.4 version right now

pau13rown
Lapis Lazuli | Level 10

im not sure it makes any sense. why is slope not negative in the 20s where it's dipping down? correlation=autocorrelation?

Reeza
Super User

@pau13rown The graph is of slope over time, so the first image which is based off the second table below I assume. 

 

@matt23 What are your definitions of slope and correlation? SAS is packaged by modules, so 9.4 does not tell me if you have SAS /ETS or specifically if you can use PROC EXPAND which is used to calculate moving statistics easily. 

 

 

 

pau13rown
Lapis Lazuli | Level 10

oh ok, load "sensibility"

matt23
Quartz | Level 8
proc product_status;run  

 For SAS/ETS ...
Custom version information: 14.2

 

Sorry, I don't know what it means

Reeza
Super User

Still need to know how you're defining slope and correlation here.

 


@matt23 wrote:
proc product_status;run  

 For SAS/ETS ...
Custom version information: 14.2

 

Sorry, I don't know what it means


 

matt23
Quartz | Level 8

Load = Intercept + Slope * Temperature

 

So I believe the slope is from regression at a specific time if I am not mistaken

Correlation is a correlation between load and temperature at time 

 

I don't know if it makes sense

Reeza
Super User

You can't have a correlation or slope with only a single or even two observations, so it's a moving statistics of some kind. You need to define the window. 

 Depending on the window and exact calculations I'd probably recommend either an array approach or PROC EXPAND.

 

Here's the PROC EXPAND documentation:

 

http://documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_expand_examples04.htm&docsetVersion=...

 

Available transformations:

http://documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_expand_details19.htm&docsetVersion=1...

 

Otherwise, an array.

http://support.sas.com/kb/25/027.html

 

You'll likely need to write the formula for the slope/intercept either way, by determining the formulas/components and doing the calculation.

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