Dear experts,
I have a data example shown below. This dataset consists of multiple year firm revenue observations. What I need is to generate two new variables "pre2012" and "post2012". "pre2012" will be the average revenue of year 2010-2012 which is 60, while "post2012" will be the average revenue of year 2013-2015 which is 85. Could you please show me how to create these two variables? Than you so much!
I have a data example shown below. This dataset consists of multiple year firm revenue observations. What I need is to generate two new variables "pre2012" and "post2012". "pre2012" will be the average revenue of year 2010-2012 which is 60, while "post2012" will be the average revenue of year 2013-2015 which is 85. Could you please show me how to create these two variables? Than you so much!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear year firm revenue pre2012 post2012 2010 1 50 60 85 2011 1 60 60 85 2012 1 70 60 85 2013 1 80 60 85 2014 1 85 60 85 2015 1 90 60 85 end
Comment