BookmarkSubscribeRSS Feed
somebody
Lapis Lazuli | Level 10

I have a large dataset that contains daily returns for a many stocks. The dataset has 3 columns: date, stocks, and returns.
I would like to calculate the rolling correlation and covariance between stocks for the last 1 week, 4 weeks (month), and 50 weeks (year).

FYI, I am implementing a Corsi HAR model as I try to predict correlation next period using the correlation between stocks during the last 1 week, 4 weeks and 50 weeks. What would be the best approach?

Thank you very much for your help!

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

You can use PROC TIMESERIES with the OUTCROSSCORR= option. 

 

Provide sample data for code answer 🙂

somebody
Lapis Lazuli | Level 10

please see this link for the data it is too large to upload. (76mb) since it contains daily observations for some stocks.

https://www.dropbox.com/s/wfngi8ayjj0drh2/stocks.csv?dl=0

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1601 views
  • 1 like
  • 2 in conversation