Hi,
I am doing a research where I have to find the monthly beta of around 1000 stocks for 15 years. I have created a SAS table which contain daily historic data of all the stocks and also the market from 2002 to 2017. I would like to find the monthly beta with 30 data points without overlapping values. I would highly appreciate if somebody could help with the coding.
What is Beta? Please post some sample data that reflects your actual data and anything you've attempted as well.
@renjithradhakri wrote:
Hi,
I am doing a research where I have to find the monthly beta of around 1000 stocks for 15 years. I have created a SAS table which contain daily historic data of all the stocks and also the market from 2002 to 2017. I would like to find the monthly beta with 30 data points without overlapping values. I would highly appreciate if somebody could help with the coding.
Thank you for your reply!
In excel beta is often calculated by either calculating the slope or by covariance.
Beta =covariance.p(B2:B32,A2:A32)/var.p(A2:A32) or
Beta = SLOPE (A2: A32; B2:B32)
In this formula column A is the market and B is the stock to be calculated. In the screen shot MSCI_Return is the market.
Do you have SAS/ETS? If so, look into PROC EXPAND. If you don’t, there are also some links here on how to do that with a data step.
If you search on here, this has been asked at least twice this year so far and there are answers on here as well.
https://blogs.sas.com/content/iml/2016/01/27/moving-average-in-sas.html
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.