Hi.

I have a problem with a huge list of >19,000 towns. There are > 1,200 towns with duplicates (regarding name (dup != 0)), and the same ("AB") or different string in region.
Now, the aim is to identify the code of all duplicates out of region "AB" with same name if one town out of the respective "group" of duplicates is located in region "AB".
In the following example, those desired codes would be:
12345
12346
(both are located out of region "AB", but share the name "Village" with the town of code 12344 located in region "AB").

Code:
input code str25 name str2 region
12344 "Village" "AB"    
12345 "Village" "TB"    
12346 "Village" "DC"    
12347 "Brisbane City" "AB"    
12348 "Torrento" "TB"    
12349 "Torrento" "TB"    
12350 "Brisbane City" "AB"
12351 "Swanlake" "DC"
12352 "Island" "WR"
end

duplicates tag name, gen(dup)
How may I do this with Stata commands instead of manually in Excel or something similar?
Is that clear?