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
logout nicely formatted tablesDear all, I want to export table in Excel, but to have nice and funcional table. I have categorical…
Insignificant values (p>0.05)My values are insignificant (p>0.05). I am very new to stata so my knowledge is limited. Excuse m…
Event study with quarterly reports!Hello! I'm a student currently working on my bachelor's thesis in finance. I want to test post-earn…
osrmtime, traveltime, geocodeDear All, I'm new in this forum, but I've been using the software for quite a time. I'm trying to ca…
dropping multiple observations for same idsHi, I am trying to drop some of my repeated observations. I attached a screenshot, there are multipl…
Subscribe to:
Post Comments (Atom)
0 Response to Average and Median values by group
Post a Comment