----------------------- copy starting from the next line -----------------------
- * Example generated by -dataex-. To install: ssc install dataex
- clear
- input float(Stkcd year pisition1_id position2_id)
- 1 2008 111 100
- 1 2009 111 100
- 1 2010 111 200
- 1 2011 222 200
- 1 2012 222 200
- 2 2012 100 111
- 2 2013 100 111
- 2 2014 100 111
- 2 2015 333 300
- 2 2016 333 300
- 3 2007 555 222
- 3 2008 555 222
- 3 2009 555 222
- 3 2010 444 222
- 3 2011 444 555
- 4 2015 666 300
- 4 2016 666 300
- 4 2017 300 800
- 4 2018 300 800
- 4 2019 300 800
- end
------------------ copy up to and including the previous line ------------------
上述数据为企业在各个年份的职务1和职务2的任职情况,由不同的ID的人员任职
期望得到的结果是:
若position2的人员(id)在某Stkcd任职,但几年后更换职务,任职position1(无论是否更换Stkcd),则保留该id在跳槽之前以及跳槽之后的所有样本。
同理position1 跳到 position2 的样本同上保留。