Greetings, Overall, looking at the table I attacked, the logic is as follow: Before the first event for each firm, (before 1995) the variable want_var would equal 0 The first event is in 1995, the next event is in 1996, so since the difference between those two events is only one year, the variable want_var will equal 1 for both those years (1995, and 1996) The second event and the third event are three years apart ( 3 non event years apart) (1996 to 2000), so the variable want_var will equal 1 for the event year 1996 and 2000 and zero during the those three non event years. Once again, the next event is only one year apart (in 2001) so want_var=1, Between the 2001 event and 2003 event there is only one non event year, so want_var=1 for all those years. (2001,2002,2003) Between the 2003 event year and 2014 event year , there are 10 non event years, so what I want to achieve in the case of difference>3 of non event years years is having the new variable want_var equal 1 from 2004 until 3 years before the next event which is 2014, so it would equal 1 on 2003 and 2014 , from 2004 until 2010, and then equal 0 in 2011,2012,2013. Then lastly, if the last event year (2014) is not the last year recorded for that firm (2016), want_var =1 for all consecutive years until the end of data of that specific firm. i hope what I want to achieve is more clear Thank you
... View more