Hello everybody!

Can you please help me with the following problem?

I have created an easy example - attached in the excel - that perfectly replicates what I would need to do in a larger dataset.

It is a balanced panel data (2017,2014,2010) where, unfortunately, the "ID" of the same person might change over time.
For example, ID=6 in 2017 takes the value =99 in 2010. The same happens for all IDs from 6 to 10.
On the contrary, IDs from 1 to 5 perfectly match over the three years.

I would need a code that match correctly the IDs over the different years. In other words, in the example, by sustituting 99 with 6, 98 with 7 etc.

I hope it is clear.

Thank you for your support.

Best,
Nicola