Hello Statalist,

I I've tried many things and I do not know what to do and ask for help now.

My datasets are like this:
ID Year treatment Var3
1 4 0 ...
1 5 1 ...
2 7 0 ...
2 8 1 ...

And I would like to classify the treatment with 1 as the group among the IDs whose year is less than 5 years.

What I mean is that, keep ID 1 and drop ID 2, because treatment year of ID 1 is 5, and ID 2 is 7.
ID Year treatment Var3
1 4 0 ...
1 5 1 ...
Could you please give me some hints or inspirations


Thanks in advance.