Hi, I am still new to stata and I have encountered problems.

I have this set of data,

I only want to keep companies with consecutives year from 2007 to 2016 and 2007 to 2017, what command should I use?

Thank you
Company Years
A 2007
A 2008
A 2009
A 2010
A 2011
A 2012
A 2013
A 2014
A 2015
A 2016
A 2017
B 2008
B 2009
B 2010
B 2011
B 2012
B 2013
B 2014
B 2015