Hi,

I had a firm-level survey in different countries. I want to calculate the change in "score" (diff_score) of each firm in the most recent survey compared to the last one. Could anyone please give me some advice?

Thank you very much

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long idstd int year str9 country byte(score diff_score)
442051 2013 "Mongolia"  3  .
442051 2019 "Mongolia"  2 -1
442053 2013 "Mongolia"  1  .
442053 2019 "Mongolia"  2  1
548327 2014 "Myanmar"   0  .
548327 2016 "Myanmar"   0  0
548328 2014 "Myanmar"   2  .
548328 2016 "Myanmar"   0 -2
548329 2014 "Myanmar"   2  .
548329 2016 "Myanmar"   2  0
591268 2009 "Indonesia" 1  .
591268 2015 "Indonesia" 3  2
591269 2009 "Indonesia" 0  .
591269 2015 "Indonesia" 1  1
599493 2009 "Vietnam"   0  .
599493 2015 "Vietnam"   2  2
599494 2009 "Vietnam"   0  .
599494 2015 "Vietnam"   1  1
599495 2009 "Vietnam"   0  .
599495 2015 "Vietnam"   1  1
627100 2016 "LaoPDR"    0  .
627100 2018 "LaoPDR"    2  2
627103 2016 "LaoPDR"    0  .
627103 2018 "LaoPDR"    0  0
627104 2016 "LaoPDR"    0  .
627104 2018 "LaoPDR"    1  1
627105 2016 "LaoPDR"    0  .
627105 2018 "LaoPDR"    0  0
end