Dear Statalist members,
I know that there is simple way to drop the duplicate variables using Stata. However, is there a way to do the opposite? I mean drop variables that are not duplicates.
For example, the data below with panelid and panel variable shows that if data is collected in 3 years, there will be 3 times the variable "pabelid" appearing. If there is only 1 year, there will be only 1 variable.
Is there a way I can drop all the variables with panel consisting of only 1 year?
Thank you in advance. Sorry if my explanation is somehow complicated.

panelid panel
101007 2006, 2010 and 2017
101007 2006, 2010 and 2017
101007 2006, 2010 and 2017
101018 2006, 2010 and 2017
101018 2006, 2010 and 2017
101018 2006, 2010 and 2017
101021 2006, 2010 and 2017
101021 2006, 2010 and 2017
101021 2006, 2010 and 2017
101025 2006, 2010 and 2017
101025 2006, 2010 and 2017
101025 2006, 2010 and 2017
101038 2006, 2010 and 2017
101038 2006, 2010 and 2017
101038 2006, 2010 and 2017
101041 2006, 2010 and 2017
101041 2006, 2010 and 2017
101041 2006, 2010 and 2017
101043 2006, 2010 and 2017
101043 2006, 2010 and 2017
101043 2006, 2010 and 2017

panelid panel
622654 2017 only
622655 2017 only
622656 2017 only
622657 2017 only
622658 2017 only
622659 2017 only
622660 2017 only
622661 2017 only
622662 2017 only
622663 2017 only
622664 2017 only
622665 2017 only
622666 2017 only
622667 2017 only
622668 2017 only
622669 2017 only
622670 2017 only
622671 2017 only
622672 2017 only