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
Percentage increase in estimated probabilities for binary treatment and binary outcomesI have a binary outcome variable and a binary treatment variable. Using margins, it's easy enough to…
Panel ARDL Huasman test>>>"invalid new variable name"Dear Stata Team, I am running a Panel ARDL model but want to choose between "mg" or "pmg" using the …
Help in reshapingHi I have a dataset of industrial clusters which are segmented into districts, states and products (…
Quarterly population data into monthly dataDear Statalist experts, I have the following data set, I have been trying to transform this quarterl…
regress by both industry and areaDear Statalist, I understand how to divide firms into industries and regress firms by industry, and…
Subscribe to:
Post Comments (Atom)
0 Response to Rolling yearly earnings
Post a Comment