My data has duplicate cases, I want to remove duplicate case if they report '2' as response in variable s2dq01
Details of my problem. I am using HIES 2018-19 for Pakistan, I want to merge roaster with file about health, however, when i run following command
Code:
isid hhcode idc
duplicates report hhcode idc
duplicates list hhcode idc in 1/2000
AND OUT IS LIKE AS FOLLOWS

variables hhcode idc should never be missing

Code:
Duplicates in terms of hhcode idc

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |        47095             0
        2 |         1742           871
        3 |          111            74
        4 |           20            15
--------------------------------------
it gives duplicate cases like
Code:
 +----------------------------------+
  | group:   obs:       hhcode   idc |
  |----------------------------------|
  |      1      7   1102100106     1 |
  |      1      8   1102100106     1 |
  |      2     72   1102101305     1 |
  |      2     73   1102101305     1 |
  |      3    506   1121100414     1 |
  |----------------------------------|
  |      3    507   1121100414     1 |
  |      4   1022   1141100112     1 |
  |      4   1023   1141100112     1 |
  |      5   1130   1141300310     1 |
  |      5   1131   1141300310     1 |
  |----------------------------------|
Using the following data

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double hhcode byte(idc s3dq01)
1102100101  1 2
1102100102  1 2
1102100102  3 1
1102100103  1 2
1102100104  1 2
1102100105  1 2
1102100106  1 1
1102100106  1 2
1102100107 56 1
1102100108  1 2
1102100108 53 1
1102100109 55 1
1102100110  1 2
1102100110 56 1
1102100111  1 2
1102100112  1 1
1102100112 51 1
1102100501  1 2
1102100501 51 2
1102100502 51 1
1102100502 52 1
1102100502 53 1
1102100503 56 1
1102100504  1 2
1102100504 51 2
1102100505  1 2
1102100505 51 2
1102100506 52 1
1102100507 51 1
1102100508 51 1
1102100509  1 2
1102100509 51 2
1102100510 56 1
1102100511  1 2
1102100511 51 2
1102100512  1 2
1102100512 51 2
1102100901  1 2
1102100901 52 1
1102100902  1 1
1102100902 51 2
1102100903  1 2
1102100903 51 2
1102100904  1 2
1102100904 51 2
1102100905  1 1
1102100905 51 2
1102100906  1 1
1102100906 51 1
1102100907  1 2
1102100907 53 1
1102100908  1 2
1102100908 51 2
1102100909  1 2
1102100909 52 1
1102100909 53 1
1102100910  1 2
1102100910 51 2
1102100911  1 2
1102100911 51 2
1102100912  1 2
1102101301  1 2
1102101301  3 1
1102101301 51 2
1102101302  1 2
1102101302 51 1
1102101302 54 1
1102101303  1 1
1102101303 51 1
1102101304  1 2
1102101304 51 1
1102101305  1 1
1102101305  1 2
1102101306  5 1
1102101306 60 1
1102101306 61 1
1102101307  1 1
1102101307 51 1
1102101307 52 1
1102101308  1 2
1102101308 51 1
1102101309  1 1
1102101309 57 1
1102101310  1 2
1102101310 54 1
1102101311  1 2
1102101311 51 1
1102101312  1 2
1102101312 52 1
1102101701  1 2
1102101701 51 2
1102101702  1 2
1102101702 51 2
1102101703  1 2
1102101703 51 2
1102101704  1 2
1102101704 51 2
1102101705  1 2
1102101705 51 2
1102101706  1 2
end
label values s3dq01 LABB
label def LABB 1 "yes", modify
label def LABB 2 "no", modify
Listed 100 out of 48968 observations

Complete original files Roaster (plist.dta) and health (sec_3d.dta) are attached for consideration.