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!
You can use PROC TIMESERIES with the OUTCROSSCORR= option.
Provide sample data for code answer 🙂
please see this link for the data it is too large to upload. (76mb) since it contains daily observations for some stocks.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.