Hi Statalisters,

I am working on my data cleaning and have such a problem.

When I use
duplicates report
command working on some variables to check duplicates. I find within these assigned variables, duplicates happen because some observations are missing while others are not.

Say an example.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double fyear str6 gvkey str10 cusip str58 conm str100 conml str6 naics str4 sic double(at ni xrd sale)
1989 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 129.514 -8.987 2.381 121.159
1990 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812"  118.12  2.574     . 144.258
1990 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812"  118.12  2.574 1.607 144.258
1991 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 114.384 12.302     . 140.112
1991 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 112.548 12.302 1.742 140.112
1992 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 114.646   .484 2.501   113.5
1992 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 114.646   .484     . 113.132
1993 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 109.156  1.617     . 123.632
1993 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 109.156  1.617 2.162  124.13
1994 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 101.418  1.769     . 126.537
1994 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 101.418  1.769 2.206  126.78
end
The above demo is a piece of my sample data. I use command
duplicates report fyear gvkey cusip conm conml naics sic
to check if there are duplicates under these assigned variables. By using
duplicates list fyear gvkey cusip conm conml naics sic
, we know for example, the following four observations contain two duplicates. To drop proper duplicates, I want to drop those observations that contain missing observations in variable xrd in priority. How to achieve this logic in duplicates drop operation?

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double fyear str6 gvkey str10 cusip str58 conm str100 conml str6 naics str4 sic double(at ni xrd sale)
1992 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 114.646   .484 2.501   113.5
1992 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 114.646   .484     . 113.132
1993 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 109.156  1.617     . 123.632
1993 "001017" "001030105" "AEL INDUSTRIES  -CL A" "AEL Industries" "334511" "3812" 109.156  1.617 2.162  124.13
end
Thanks in advance