Hi

I need to create a certain variable by sorting other variables, but I am not sure how to sort them.
The variable names and short descriptions are below:

Name Descriptions
snf skilled nursing facility code
md if the provider is a doctor equals 1, otherwise 0
ap if the provider is an advanced practitioner equals 1, otherwise 0


The number of observations in the dataset is 966,706
and the number of the unique snf codes is 16,500

From them, I wanna get a variable which has only snf codes with both md and ap (md==1 and ap==1).
In other words, I want a snf code list that has both md and ap.

Any advice would be highly appreciated. Thank you so much in advance!