Dear All, Suppose that I have this data set
For each company (id), if D is less than 0.3 in year 2011 AND D is in the range [0.3,0.4] in year 2012, the desired outcome is that wanted=1 for id=1. Otherwise, wanted=0. Any suggestions? Thanks.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(id year D wanted) 1 2010 .23 1 1 2011 .25 1 1 2012 .33 1 1 2013 .41 1 2 2010 .32 0 2 2011 .43 0 2 2012 .37 0 2 2013 .29 0 3 2010 .12 1 3 2011 .18 1 3 2012 .38 1 3 2013 .25 1 end

Comment