Stata: Drop company if last stock value of prior year is smaller than a certain value

Hey all,

I have a CRISP dataset with daily stock values for campanies from the first of december 2010 until the end of 2011.

Now I need to check if the last stock value in december of 2010 is smaller than 17 (price<17). If yes, I need to drop every value for this company (companyid).

I have no clue how to solve that at the moment, would really appreciate some help:tup:

Thanks in advance :)

(Bonus question: The date for the last known stock value in december varies, how to include that?) Edit: Found the solution for the bonus question, got lucky.
Last edited: