Dear Stata Community,
I have a panel dataset with monthly excess returns for 25 portfolios starting from 1927 until 2020. I calculated rolling betas over 60 months between the returns of the portfolio and the market, then moving 1 month ahead and so on, so there is a beta for every month and portfolio starting from 1932 (after the first 5 years). The next step, where I am struggling, is to create a new portfolio where I take in every month the average return of the 5 portfolios with the lowest/highest beta. To be clear, the 5 portfolios can change every month until 2020. So there is a new portfolio that takes in every month the average return of the 5 portfolios with the lowest/highest beta. The variables I have are time (months from 1927 until 2020, the 25 portfolios (with excess returns for each month) and last the betas.
It is actually not that complicated but I am new to Stata and sadly found nothing specific in the FAQ that would address my problem.
Maybe one of you has an idea how to code this or which command I could use?
I appreciate your time and thank you very much in advance
I have a panel dataset with monthly excess returns for 25 portfolios starting from 1927 until 2020. I calculated rolling betas over 60 months between the returns of the portfolio and the market, then moving 1 month ahead and so on, so there is a beta for every month and portfolio starting from 1932 (after the first 5 years). The next step, where I am struggling, is to create a new portfolio where I take in every month the average return of the 5 portfolios with the lowest/highest beta. To be clear, the 5 portfolios can change every month until 2020. So there is a new portfolio that takes in every month the average return of the 5 portfolios with the lowest/highest beta. The variables I have are time (months from 1927 until 2020, the 25 portfolios (with excess returns for each month) and last the betas.
It is actually not that complicated but I am new to Stata and sadly found nothing specific in the FAQ that would address my problem.
Maybe one of you has an idea how to code this or which command I could use?
I appreciate your time and thank you very much in advance

Comment