Hi, I would like to create a dummy which would record if any executive changes between two years and zero otherwise. Normally I would not have problem with this I would first generate the first differences of executive identifier and afterwards replace any non-zero values by one. However, in my case I have also multiple executives per firm in a given year and I dont really know how to handle it.

Here is example of the dataset, thanks in advance for any help:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int fyear long execno str5 tickersymbol
2007 45344 "FF"   
2007 45341 "FF"   
2007 45348 "FF"   
2007 45349 "FF"   
2007 45340 "FF"   
2007 45347 "FF"   
2007 45343 "FF"   
2007 45345 "FF"   
2008 45340 "FF"   
2008 45348 "FF"   
2008 45344 "FF"   
2008 45349 "FF"   
2008 45339 "FF"   
2008 45345 "FF"   
2008 45343 "FF"   
2008 45341 "FF"   
2009 45341 "FF"   
2009 45345 "FF"   
2009 45349 "FF"   
2009 45344 "FF"   
2009 45340 "FF"   
2009 45343 "FF"   
2009 45348 "FF"   
2009 45339 "FF"   
2010 45340 "FF"   
2010 45344 "FF"   
2010 45348 "FF"   
2010 45349 "FF"   
2010 45345 "FF"   
2010 45341 "FF"   
2011 45340 "FF"   
2011 45341 "FF"   
2011 45349 "FF"   
2011 45339 "FF"   
2011 45344 "FF"   
2011 45348 "FF"   
2011 45346 "FF"   
2011 45343 "FF"   
2012 45343 "FF"   
2012 45342 "FF"   
2012 45340 "FF"   
2012 45349 "FF"   
2012 45339 "FF"   
2012 45344 "FF"   
2012 45341 "FF"   
2012 45346 "FF"   
2013 45339 "FF"   
2013 45343 "FF"   
2013 45344 "FF"   
2013 45349 "FF"   
2013 45346 "FF"   
2013 45340 "FF"   
2013 45342 "FF"   
2014 45340 "FF"   
2014 47215 "FF"   
2014 45349 "FF"   
2014 45339 "FF"   
2014 45342 "FF"   
2014 45343 "FF"   
2015 45340 "FF"   
2015 47215 "FF"   
2015 45339 "FF"   
2015 45349 "FF"   
2015 45342 "FF"   
2015 45343 "FF"   
2016 45343 "FF"   
2016 45340 "FF"   
2016 45342 "FF"   
2016 47215 "FF"   
2017 45340 "FF"   
2017 45343 "FF"   
2017 42577 "FF"   
2017 47215 "FF"   
2017 45342 "FF"   
2007 43361 "GSM.3"
2007 43356 "GSM.3"
2007 22272 "GSM.3"
2007 43358 "GSM.3"
2008 43358 "GSM.3"
2008 43355 "GSM.3"
2008 43356 "GSM.3"
2008 43361 "GSM.3"
2008 22272 "GSM.3"
2008 43359 "GSM.3"
2009 43361 "GSM.3"
2009 43356 "GSM.3"
2009 43359 "GSM.3"
2009 43360 "GSM.3"
2009 43358 "GSM.3"
2009 43355 "GSM.3"
2009 22272 "GSM.3"
2010 43356 "GSM.3"
2010 43361 "GSM.3"
2010 43355 "GSM.3"
2010 43360 "GSM.3"
2010 43359 "GSM.3"
2011 43361 "GSM.3"
2011 43359 "GSM.3"
2011 43360 "GSM.3"
2011 43355 "GSM.3"
end