Hello all,
I have a question regarding the generation of a dummy variable for my panel study. For the calculation of a model (Ohlon's O-score), I need to generate a dummy variable that equals one if a firm had a net loss for the last 2 years. I.e. the variable net income (ni) has been negative the last 2 years for a specific firm.
Firms get identified by gvkey. How could I generate such a dummy?
I have a question regarding the generation of a dummy variable for my panel study. For the calculation of a model (Ohlon's O-score), I need to generate a dummy variable that equals one if a firm had a net loss for the last 2 years. I.e. the variable net income (ni) has been negative the last 2 years for a specific firm.
Firms get identified by gvkey. How could I generate such a dummy?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long gvyear int gvkey long datadate int fyear double ni 10452013 1045 20131231 2013 -1834 10452014 1045 20141231 2014 -2882 10452016 1045 20161231 2016 2676 10752010 1075 20101231 2010 350.05 10752011 1075 20111231 2011 339.47 10752012 1075 20121231 2012 381.54 end
