Hi everyone, I need some help with a code.

I try to simplify. Let's consider 2 numeric variables (A and B). I want to generate a dummy variable C = 1 when for the same value of A, the observed individual assumed the maximum value of B, and 0 otherwise.

How can I translate this problem in Stata language?

Ex.

A B C

1 4 0
1 7 0
1 8 1

2 6 1
2 2 0
2 3 0

3 1 0
3 5 1
3 0 0

Can you help me?
Thanks in advance!