Dear All
Will appreciate if you can help me on the following query.
The following data shows firms (ID), year , reform year (SSRCOMPLETEYR) and the variable NTS (ownership proportion).
I want to create variables, i.e. the mean and median of NTS with respect to the reform year. For instance, for firms which have reform year (SSRCOMPLETEYR) 2005, then I want the mean and median values of NTS for all these firms for three-years prior (2002), two-years prior(2003) and one-year prior (2004) to the reform year (2005). I also want the mean and median values of NTS for all these firms t+1, t+2 and t+3 where t is the reform year (SSRCOMPLETEYR).
* Example generated by -dataex-. To install: ssc install dataex
clear
input long ID float YEAR int SSRCOMPLETEYR float NTS
2 2003 2005 .1583336
2 2004 2005 .14580873
2 2005 2005 .13422763
2 2006 2005 .129922
2 2007 2005 .02426268
2 2008 2005 .026378496
2 2009 2005 .002197306
2 2010 2005 .0017612013
2 2011 2005 .0016758556
2 2012 2005 .001673647
2 2013 2005 .0021632616
2 2014 2005 .0014382304
4 2014 2006 .001205394
6 2003 2006 .37771195
6 2004 2006 .37771195
6 2005 2006 .37771195
6 2006 2006 .2533447
6 2007 2006 .13797276
6 2008 2006 .08924162
6 2009 2006 .02732855
6 2010 2006 .02611745
6 2011 2006 .021394266
6 2012 2006 .01581895
6 2013 2006 .0087063005
6 2014 2006 .008220699
Many thanks
Yahya Ghazali
Related Posts with Average and Median values by group
Generating a variable that takes value 1 if other characteristics of other variables are fulfilledHi I have to generate a dummy variable X1 that takes the value of 1 if only ONE of the dummy variab…
How to calculate the team size?I have a dataset as below. There are two columns, one is the team ID, the other is the team member I…
Help with graph.Hello to all. I'm trying to use pciplot to plot a HR obtained from cox regression against a continu…
Question regarding -set seed-Hi, This might sound a bit silly but I just wanted to be sure. If I am understanding the help file…
how to regress with the same coefficients for many vairiablesHi guys, I want to do a regression like the equation showed in the following picture. I have date fo…
Subscribe to:
Post Comments (Atom)
0 Response to Average and Median values by group
Post a Comment