Hi STATLIST,

Merry Christmas to those celebrating it and happy new Year.
I have a question about the creation of a dummy variable. In particular I have a list of product names each repeated once that I have merged with a panel dataset in which they all appear repeated in time. The panel dataset contains more than 9000 products repeated in time. My list contains about 500 products not repeated in time (is just a simple list). What I would like to do is create a dummy variable taking on value 1 in the panel if the product name in the panel also appear in the list. I will give you a dateax:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str19 recalled_products str18 prd
"ADENOSINE "          "ALPHA-KETOGLUTARIC"
"ADRUCIL "            "ISOPROPYL ALC/BENZ"
"TROVAN"              "ISOPROPYL ALC/BENZ"
"TEKTURNA"            "ISOPROPYL ALC/BENZ"
"ALOSETRON HCL"       "ISOPROPYL ALC/BENZ"
"ORLAAM"              "ISOPROPYL ALC/BENZ"
"DIETHYLPROPION HCL"  "ISOPROPYL ALCOHOL" 
"AMPHETAMINE SALTS"   "ISOPROPYL ALCOHOL" 
"CYTADREN "           "ISOPROPYL ALCOHOL" 
"AMINOPHYLLINE "      "ALCOHOL"           
"AMYTAL SOD"          "ALCOHOL"           
"PRAMOXINE/HC"        "ALCOHOL"           
"LOVENOX"             "ALCOHOL"           
"DIET SUPP EPHEDRA"   "ALCOHOL"           
"ASPIRIN "            "ALCOHOL"           
"AUVI-Q"              "ALCOHOL"           
"CLINIMIX"            "ALCOHOL"           
"BIOSCANNER KETONE"   "ALCOHOL"           
"PFIZERPEN G"         "ALCOHOL"           
"VASCOR"              "ALCOHOL"           
"PAMPRIN"             "ALCOHOL"           
"BICALUTAMIDE "       "20/20 EYE GLSS CLN"
"BISMUTH SUBGAL"      "20/20 EYE GLSS CLN"
"ANTIVENIN"           "20/20 EYE GLSS CLN"
"BLEPHAMIDE"          "20/20 EYE GLSS CLN"
"LIPO 6"              "20/20 REWETTING"   
"BOOST "              "360 OTC EXTRA STR" 
"BORIC ACID "         "360 OTC EXTRA STR" 
"HEPARIN SOD"         "4-WAY"             
"BROMFENAC SOD"       "4-WAY"             
"BROMOCRIPTINE MESY"  "4-WAY"             
"BUPRENORPHINE HCL"   "4-WAY"             
"BUPROPION HCL SR W"  "4-WAY"             
"BURN "               "4-WAY"             
"BHT"                 "4-WAY"             
"CARBINOXAMINE CMPD"  "4-WAY"             
"CARISOPRODOL "       "4-WAY"             
"SHARK CARTILAGE"     "4-WAY"             
"ZYMAR"               "4-WAY"             
"CELECOXIB "          "4-WAY"             
"CERTA-VITE SENIOR"   "666"               
"AQUACHLORAL"         "666"               
"CHLORAMPHENICOL "    "666"               
"LOBAC"               "666"               
"CHLOROFORM  "        "666"               
"CHLOROQUINE PHOS"    "666"               
"CHORIONIC GONADO"    "666"               
"CLIOQUINOL "         "666"               
"NEOCIDIN"            "666"               
"CLOMIPRAMINE HCL"    "666"               
"CLOZAPINE "          "666"               
"CD/PSE"              "666"               
"ACETAMINOPHEN PM"    "7-KETO DHEA"       
"COUMADIN "           "7-KETO DHEA"       
"CUBICIN"             "7-KETO DHEA"       
"VASODILAN"           "7-KETO DHEA"       
"CYPROHEPTADINE HCL"  "7-KETO DHEA"       
"DRISTAN"             "7-KETO DHEA"       
"ALEVAZOL"            "7-KETO DHEA"       
"DEXAMFETAMINE "      "7-KETO DHEA"       
"PROPOXYPHEN-N/APAP"  "7-KETO DHEA"       
"DICLOFENAC SOD"      "7-KETO DHEA"       
"DICYCLOMINE HCL"     "7-KETO DHEA"       
"ORTHO DIENESTROL"    "7-KETO DHEA"       
"DIETHYLSTILBESTROL " "A & D PERSONAL CAR"
"MOTOFEN"             "A & D PERSONAL CAR"
"GUANIDINE"           "A & D PERSONAL CAR"
"LOMOTIL"             "A & D PERSONAL CAR"
"TRANDATE"            "A & D PERSONAL CAR"
"TIKOSYN"             "A & D PERSONAL CAR"
"ANZEMET"             "A & D PERSONAL CAR"
"DOMPERIDONE "        "A & D PERSONAL CAR"
"DOXYCYCLINE HYCLAT"  "A & D PERSONAL CAR"
"DICYCLOMINE HCL"     "GARLIC/PARSLEY"    
"DROPERIDOL "         "GARLIC/PARSLEY"    
"RAPTIVA"             "GARLIC/PARSLEY"    
"EPINEPHRINE "        "GARLIC/PARSLEY"    
"ERYTHROMYCIN"        "GARLIC/PARSLEY"    
"ERYTHROMYCIN ESTOL"  "GARLIC/PARSLEY"    
"ALCOHOL SWABS"       "GARLIC/PARSLEY"    
"PLACIDYL"            "GARLIC/PARSLEY"    
"ESTINYL"             "GARLIC/PARSLEY"    
"PEPPERMINT SPIRIT"   "GARLIC/PARSLEY"    
"ETOMIDATE "          "GARLIC/PARSLEY"    
"OBIZUR"              "GARLIC/PARSLEY"    
"FELBAMATE "          "GARLIC/PARSLEY"    
"FLUVOXAMINE MAL"     "GARLIC/PARSLEY"    
"FENTANYL "           "GARLIC/PARSLEY"    
"SULFISOXAZOLE"       "GARLIC/PARSLEY"    
"DURALGINA"           "GARLIC/PARSLEY"    
"GATIFLOXACIN "       "GARLIC/PARSLEY"    
"GELATIN "            "GARLIC/PARSLEY"    
"GEMFIBROZIL "        "GARLIC/PARSLEY"    
"GENTAMICIN SULF"     "A&D CRKD SKIN RLF" 
"GLUCOSAMINE SULF "   "A&D CRKD SKIN RLF" 
"ISMELIN"             "A&D CRKD SKIN RLF" 
"DYNABAC"             "A+D FIRST AID"     
"MITOXANTRONE HCL"    "A+D FIRST AID"     
"PHENYLPROPANOLAMIN"  "A+D FIRST AID"     
"SORINE"              "A+D FIRST AID"     
end
Of course the panel is the variable prd which continues (and is much much longer than the variable "recalled_products"). So for instance for the first product ADENOSINE, I would like to create a variable taking on value 1 when the prd variable takes on the name ADRENOSINE (I am sure that all the names in "recalled_products are present also in prd), so in our case, even if it is not present, 12 times (the panel repeats 12 times for ADENOSINE).

Thank you very much,

Federico