Hello everyone, this is my first post here and I'm relatively new to Stata so I was hoping to get some help on an issue I am stuck with.

I have a large dataset (panel data) of different corporations and I want to code it so as to verify a condition: ratio3==1 for three consecutive years as those are the companies I am interested in. I would then drop all the others for which the condition doesn't hold for three years in a row.

Could you please help? Any insight would be greatly appreciated!

Thanks!