BookmarkSubscribeRSS Feed
renjithradhakri
Calcite | Level 5

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. 

3 REPLIES 3
Reeza
Super User

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. 


 

renjithradhakri
Calcite | Level 5

beta.PNG

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.

Reeza
Super User

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

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1301 views
  • 0 likes
  • 2 in conversation