Hi all,
I am working on a dataset consisting of quarterly company data with multiple companies over the period 2000-2020. In the dataset I have quarterly earnings, which I would like to convert in a 4 period rolling yearly earnings. For example in 19Q3 I would like the sum of 18Q4, 19Q1, 19Q2 and 19Q3. However, this needs to be per company, which implies that the code should stop summing the values of the first company when a new companyid is reached and should continue when 4 values of that company are available.
I have tried many things from rangestat to tsegen, but it did not work. Seems like an easy task but already spend 4 hours trying. Could anyone help me with this?
Thanks a lot!
Related Posts with Rolling yearly earnings
power analysis after ttestI'm trying to import the means and stds from a two sample ttest into power twosample, but the power …
xtqreg and reghdfeHello, My question can be summarized as... why does xtqreg and reghdfe produce similar results when…
Error Code r 601Hello, I am trying to import an excel file into STATA but I receive the error code r 601. I am usin…
Problems with -collapse- commandHi all, I have a problem when I use the -collapse- command. In the following code every time I use …
appending a string and time variablesTwo of the variables in my dataset needs to be appended into a new variable. The first of represents…
Subscribe to:
Post Comments (Atom)
0 Response to Rolling yearly earnings
Post a Comment