I want to create a dummy for export starters to non-exporters in the years before entry. How can I code this?


When Export[_n]==1 & Export[_n-1]==0, generate Starter=1 and Non-exporter=0 in the previous year.

Year Firm Export Export_Starter(Desired dummy)
2010 1 0 0
2011 1 0 .
2012 1 0 .
2010 2 0 1
2011 2 1 .
2012 2 0 .
2010 3 1 .
2011 3 1 .
2012 3 1 .
2010 4 0 0
2011 4 1 .
2012 4 1 .