Stata - syntax for if exp

Using Stata -

Scenario:

variable x (Income values 1-7 on scale)

variable y (Education values 1-7 on scale)

variable z (States coded 1-50)

I would like to regress y (dependent variable) on x (independent variable) while limiting y to those observations having a value greater than the mean of those with the same z value.

Said another way - I want to regress education on income but only the education observations that are above the mean of the state from which the observation is denoted (i.e. those observations for education which are above the mean for Arkansas for respondents from Arkansas, and Montana from Montana, etc.).

Any idea how I would write that expression?

Thank you