Dear,
I have a dataset, id is number of the specific firm, if it failed within the observed period, the failure equals 1, otherwise 0.
I need to count in each year, how many firms fail not observations.
I use this command:
codebook id if failure==1 & year==2010
codebook id if failure==0 & year==2010
Are there any more convenient way to count? because actually I have 10-years data and also other variables as conditions, it costs too much time if I count year by year.
Thank you in advance!
Best
Josh
* Example generated by -dataex-. For more info, type help dataex clear id revenue year failure 1 0 2010 0 1 0 2012 0 2 0 2010 0 2 0 2011 0 2 0 2012 0 2 9000 2013 0 2 0 2014 0 2 0 2015 0 3 13000 2010 1 3 16500 2011 1 3 0 2012 1 3 0 2013 1 3 18100 2014 1 3 0 2015 1 4 15000 2010 1 4 39000 2011 1 5 0 2014 0 6 434573 2010 1 6 210080 2011 1 6 404003 2012 1 6 474938 2013 1 6 294145 2014 1 6 319562 2015 1 end
I have a dataset, id is number of the specific firm, if it failed within the observed period, the failure equals 1, otherwise 0.
I need to count in each year, how many firms fail not observations.
I use this command:
codebook id if failure==1 & year==2010
codebook id if failure==0 & year==2010
Are there any more convenient way to count? because actually I have 10-years data and also other variables as conditions, it costs too much time if I count year by year.
Thank you in advance!
Best
Josh
* Example generated by -dataex-. For more info, type help dataex clear id revenue year failure 1 0 2010 0 1 0 2012 0 2 0 2010 0 2 0 2011 0 2 0 2012 0 2 9000 2013 0 2 0 2014 0 2 0 2015 0 3 13000 2010 1 3 16500 2011 1 3 0 2012 1 3 0 2013 1 3 18100 2014 1 3 0 2015 1 4 15000 2010 1 4 39000 2011 1 5 0 2014 0 6 434573 2010 1 6 210080 2011 1 6 404003 2012 1 6 474938 2013 1 6 294145 2014 1 6 319562 2015 1 end
Comment