Hi Statalisters,

hope to find you all well.

So, the problem is the following. I have two large panel datasets called P1 and P2. They are both unbalanced ad P1 spans from 1996-2003, while P2 ranges 2004-2015.
I'll give you a strip of P1 (P2 is structured the same, only in different time slots):

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str4 atc3no float(Year ln_sales dummy_3)
"A10B" 1996 20.291494 0
"A10B" 1997  21.34455 0
"A10B" 1998  21.84049 0
"A10B" 1999  22.05324 0
"A10B" 2000  22.30247 0
"A10B" 2001  22.57403 1
"A10B" 2002  22.51897 0
"A10B" 2003  22.57693 0
"A10C" 1996  20.16122 0
"A10C" 1997  20.85058 0
"A10C" 1998 20.987705 0
"A10C" 1999  21.13734 0
"A10C" 2000  21.19741 0
"A10C" 2001  21.33309 0
"A10C" 2002  21.43861 0
"A10C" 2003  21.55456 0
"A10D" 1996 17.580471 0
"A10D" 1997 18.168818 0
"A10D" 1998  18.08304 1
"A10D" 1999 17.383436 0
"A10D" 2000 16.104752 0
"A10D" 2001 15.530873 0
"A10D" 2002  15.22075 0
"A10D" 2003  14.92634 0
"A10E" 1996 10.437412 0
"A10E" 1997  9.073948 0
"A10E" 1998  7.628148 0
"A10E" 1999  7.518875 0
"A10E" 2000  5.197627 0
"A10E" 2001  3.583121 0
"A10E" 2002 15.441525 0
"A10E" 2003  12.41154 0
"A10X" 1996 13.587091 0
"A10X" 1997   14.2725 0
"A10X" 1998 14.538165 0
"A10X" 1999  14.70182 0
"A10X" 2000  14.79176 0
"A10X" 2001 14.884952 0
"A10X" 2002 15.002069 0
"A10X" 2003 15.011658 0
"A11A" 1996 18.149294 0
"A11A" 1997 18.807383 0
"A11A" 1998 18.674725 0
"A11A" 1999 18.626945 0
"A11A" 2000 18.659883 0
"A11A" 2001 18.801521 0
"A11A" 2002 18.762714 0
"A11A" 2003 18.711563 0
"A11B" 1996 17.753338 0
"A11B" 1997 18.184416 0
"A11B" 1998 17.893967 0
"A11B" 1999 18.150555 0
"A11B" 2000 18.211329 0
"A11B" 2001 18.255999 0
"A11B" 2002  18.15033 0
"A11B" 2003 18.287647 0
"A11C" 1996 17.362078 0
"A11C" 1997 19.053766 0
"A11C" 1998 19.440685 0
"A11C" 1999  19.24733 0
"A11C" 2000 19.424694 0
"A11C" 2001  19.64307 0
"A11C" 2002 19.877234 0
"A11C" 2003  20.03904 0
"A11D" 1996 14.842104 0
"A11D" 1997  15.36704 0
"A11D" 1998 15.312846 0
"A11D" 1999  15.36418 0
"A11D" 2000 15.276735 0
"A11D" 2001  15.19504 0
"A11D" 2002 15.228025 0
"A11D" 2003 15.413073 0
"A11E" 1996 16.847824 1
"A11E" 1997 17.881367 0
"A11E" 1998 17.221148 0
"A11E" 1999 16.782133 0
"A11E" 2000 16.595858 0
"A11E" 2001  16.60606 0
"A11E" 2002 16.534334 0
"A11E" 2003 16.592836 0
"A11F" 1996 16.181887 0
"A11F" 1997 16.963264 0
"A11F" 1998 16.855743 0
"A11F" 1999 16.514566 0
"A11F" 2000 16.485556 0
"A11F" 2001 16.467104 0
"A11F" 2002 16.533625 0
"A11F" 2003  16.69033 0
"A11G" 1996 17.923916 0
"A11G" 1997 18.525932 0
"A11G" 1998 18.347878 0
"A11G" 1999 17.834623 0
"A11G" 2000 17.594845 1
"A11G" 2001 17.335405 0
"A11G" 2002 17.265116 0
"A11G" 2003 17.294804 0
"A11X" 1996 18.267391 0
"A11X" 1997  19.13163 0
"A11X" 1998 18.883715 0
"A11X" 1999  18.65287 0
end
The identifier is based on atc3no. What I would like to do is to append P2 and P1 so that ONLY the atc3 names that they have in common are appended. Further, I will also need to drop Years from 2013 to 2015 (which I don't know if it is better to do before the append for after it).

Is there a clever way to do it rather than using reclink (which takes a lot and I am not really sure about)? The final aim is to append only the common atc3 and make the appended panel P1-P2 balanced. is there a way to do it?

Thank you,

Federico