## Slope / Sensitivity / Correlation

Solved
Frequent Contributor
Posts: 89

# Slope / Sensitivity / Correlation

Hi, I need help getting something similar to this:

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

Accepted Solutions
Solution
‎06-26-2018 03:31 PM
Super User
Posts: 23,980

## Re: Slope / Sensitivity / Correlation

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.

All Replies
Super User
Posts: 23,980

## Re: Slope / Sensitivity / Correlation

[ Edited ]

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:

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

Frequent Contributor
Posts: 89

## Re: Slope / Sensitivity / Correlation

Actually working on 9.4 version right now

Regular Contributor
Posts: 170

## Re: Slope / Sensitivity / Correlation

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

--------------
blog: papersandprograms.com
Super User
Posts: 23,980

## Re: Slope / Sensitivity / Correlation

[ Edited ]

@PaulBrownPhD 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.

Regular Contributor
Posts: 170

## Re: Slope / Sensitivity / Correlation

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

## Re: Slope / Sensitivity / Correlation

``proc product_status;run`  `

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

Sorry, I don't know what it means

Super User
Posts: 23,980

## Re: Slope / Sensitivity / Correlation

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

Frequent Contributor
Posts: 89

## Re: Slope / Sensitivity / Correlation

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

Solution
‎06-26-2018 03:31 PM
Super User
Posts: 23,980

## Re: Slope / Sensitivity / Correlation

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.

☑ This topic is solved.