Dear Statalist forum,
I have quarterly data (Year_Quarter) from 1965 until 2020 and I want to generate a four period aggregated return. I first built decile portfolios based on characterstics and then generate the average return for each portfolio by the deciles. But if I want to generate the aggregated portfolio return over four quarters I get a lot of missing values, probably because most portfolio returns are not available in four following quarters. How can I solve the problem in a way that I still get a value of four period returns? Maybe if one, two or three returns are missing ad the average of the existing returns?
I used the following code for the Asset Growth portfolio:
bys AG10: gen agreg_av_return_AG= av_return_AG + av_return_AG[_n-1]+ av_return_AG[_n-2] + av_return_AG[_n-3]
I have also tried rangestat but it seems to produce completly wrong results:
rangestat (sum) agreg_av_return_AG= av_return_AG, by(AG10) int(Year_Quarter -4 0)
I would appreciate any help. Thanks in advance!
Related Posts with Four period aggregated return
Looking for help! EASI Model in R with STATA. Thanks!I am currently trying to follow a world bank paper to estimate EASI model in R with STATA. The paper…
Parallel trend assumption using leads and lagsI am running some robustness checks to my diff-in-diff specification. In particular, I am trying to …
Group observations by Sequential DateHi, I need to group observations by participant_id where observations are date sequential (ie end_da…
Threshold VAR - imposing restrictions and generating GIRFsDear Stata users, I am using threshold in Stata 15.1 in order to estimate a fiscal policy threshold…
Runing the same merge m:m and getting different resultsHello, im working with a panel data of exports between one country and others. Each product have a u…
Subscribe to:
Post Comments (Atom)
0 Response to Four period aggregated return
Post a Comment