Question about panel data

#1
Hi,

I'm new to Stata and have firme's panel data. I want to eliminate firms that exit from export market.
I mean if a firm export in year t but didn't export in year t+1, should remove from dataset.
Firm_id year Export_status
1 82 0
1 83 0
1 84 1
1 85 0
1 89 0
2 *82 *0
2 *83 *0
2 84 0
2 85 0
2 86 0
2 87 1
2 88 1
2 89 1
2 90 0
3 87 0
3 88 0
3 89 0
3 90 1
4 85 0
4 86 0
4 87 0
4 88 1
4 89 1

In this case only firm 3 & 4 should remain.
So I tried
Bysort id (year): drop if export[_n]==1 & export[_n+1]==0

But, this command isn't correct. It do this commands for all observations. I want to do this for each firm in its available year.

I don't know is there any way in stata to do a command for each

Sorry for bad writing! Beacause I'm not English.

Thanks a lot!