I have data in long format. How do I drop subjects (id) who have only observations(days) >300. I want to keep subjects that have observations(days) <300 days & >=300 days, but want to drop subjects that only have observations >300 days and have no observations smaller than 300 days. For example (see below), I want to keep subject with id 1 and want to drop subject with id 2. But I need a code for the whole dataset of course, not just for these two subjects. Please help.
id days
1 100
1 300
1 500
2 1000
id days
1 100
1 300
1 500
2 1000

Comment