Help! I am trying to find a male match for each female observations. There are many more male than female observations. For each female observation, I need to find a male observation in the same year (fyear), with the same industry code (ff12), and with the closest value of the variable prob_female. The variable prob_female ranges from 0.0003325 to 0.1211022. What is the best command for this?

Thank you so much. I am new to this forum and a relatively new Stata user.