Hi, I have three variables: date, stock returns and market returns. I want to compute correlations such as I only use return information from the past 5 years, hence if I am in February 2019 I´d like to compute the correlation between stock returns and market returns beginning February 2014. SAS Procedures such as proc expands are not available for SAS University as far as I know.
If you search the internet for "rolling window regressions", there are several pieces of SAS code presented, that could be adapted to produce correlations. In particular, there is one code that works without macros that would apply with only minor modifications to correlations. I also recall a thread here in the SAS communities on the subject of rolling window correlations that I participated in, and I leave it to you to search for it.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.