Dear all,
I have a database with mutual fund data, for each month there are many funds and each of these funds has different stock holdings (number of shares*price) and each stock has as well the respective beta. I need to calculate for each month for each fund this value weighted average beta based on these holdings. I have come up with the commands as below, can anyone let me know whether its okay, or do i need to consider anything else?
bys fundid month_id: gen beta= sum(beta*price*numbershares)/sum(((beta)!=.)*numbershares*price)
bys fundid month_id: replace beta= Beta [_N]
Thanks in advance,
I have a database with mutual fund data, for each month there are many funds and each of these funds has different stock holdings (number of shares*price) and each stock has as well the respective beta. I need to calculate for each month for each fund this value weighted average beta based on these holdings. I have come up with the commands as below, can anyone let me know whether its okay, or do i need to consider anything else?
bys fundid month_id: gen beta= sum(beta*price*numbershares)/sum(((beta)!=.)*numbershares*price)
bys fundid month_id: replace beta= Beta [_N]
Thanks in advance,
Comment