Hi all,
I have a panel data and this table shows an annual transaction of certain fruits. Now, I try to generate a new dummy variable that can identify consumers who only buy fruit in the summer. In other words, people who purchase fruits both in summer and non-summer are excluded. Besides, people purchase fruits only in non-summer are excluded as well.

In this case, with few observations, I am able to know the person purchases fruits only in Summer whose ID = {C,E}.
ID ID over time Season (season=1 if summer; zero otherwise) Person who purchases fruits only in Summer
A 1 Summer 0
A 2 Nonsummer 0
B 1 Nonsummer 0
C 1 Summer 1
C 2 Summer 1
C 3 Summer 1
D 1 Nonsummer 0
E 1 Summer 1
F 1 Summer 0
F 2 Nonsummer 0
Indeed, I have tried several basic coding but failed.

Code:
egen x=1 if season=1, by(id)
Code:
bysort id season: generate x = _n
Also, I am new to Stata, can anyone help? Appreciate a lot.