Hello,
I have a dataset of 1,791 firm-year observations. Now, I would like - for each firm-year observation - to incorporate the earnings number of the previous 5 years.
So, for example, I have this:
Company | fyear | earnings (on t=fyear)
x | 2018 | ...
x | 2017 | ...
y | 2018 | ...
y | 2017 | ...
y | 2016 | ...
y | 2015 | ...
z | 2016 | ...
z | 2015 | ...
z | 2014 | ...
What I want to get is this:
Company | fyear | earnings (on t=fyear) | earnings t=-1 | earnings t=-2 | earnings t=-3 | earnings t=-4 | earnings t=-5
__________________________________________________ __________________________________________
My questions is thus:
How can I merge COMPUSTAT's earnings output with my firm-year observations?
If you need more information, please feel free to ask!
Kind regards,
Pepijn
Related Posts with Create laggings
Random dummy variable with restrictionsI have a panel dataset and want to create a random dummy variable with mean 0.2 that marks a random …
Outreg2 providing one-sided p-valuesDear Stata users, I have a question regarding the one-sided p-value in outreg2, which I use to expo…
Regression output - Bug?Hi everyone, I am trying to run some old code (version 14.2) using a new Stata version (15.1) on a …
Create a dummy variable that equals 1 if the compensation committee is comprised wholly of independent directorsHi everyone, I am new to the stata forum and I have some questions. To run my regression, I need som…
split, parse(,) maximum number of variables reachedDear all, I'm using Stata 15 and trying to split a string variable into different component which ar…
Subscribe to:
Post Comments (Atom)
0 Response to Create laggings
Post a Comment