Hi guys,

this is actually the first time I am posting something in this forum. I am currently working on a dataset which I got from the Thomsonone database. I want to generate a variable for unrelated diversifications. I focus on the High tech industry (SIC code 7371-7379), so I am looking for acquiring firms who acquired a firm with a SIC which is different from that of the acquirer industry (7371-7379). Before I used the command "gen divers = (sic != TargetSIC)" but then I also get the value 1 for related diversifications for instance if Firm A (7371) acquirers Firm B with the SIC 7375.
How can I tell Stata that I want to have the value 1 for the variable "divers" if the TargetSIC is outside of the High tech industry?
Thanks in advance
Marco

Here is an example of my code using the "dataex" command

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int DateAnnounced str30(TargetName TargetMacroIndustry) str4 TargetSIC str14 TargetNation str30 conm str6 cusip str30 AcquirorMacroIndustry str4 sic str13 AcquirorNation double(ofSharesAcq ValueofTransactionmil) str3 MasterDealType float divers
21538 "BuildingConnected Inc"          "High Technology"                "7372" "United States"  "Autodesk Inc"                   "052769" "High Technology" "7372" "United States"    100      275 "MA"  0
21537 "Roper Tech Inc-Scientific"      "Industrials"                    "3823" "United States"  "Teledyne Technologies Inc"      "879360" "High Technology" "7376" "United States"    100      225 "MA"  1
21537 "CovalentWorks"                  "High Technology"                "7372" "United States"  "SPS Commerce Inc"               "78463M" "High Technology" "7372" "United States"    100       23 "MA"  0
21536 "Ism Connect Llc-Assets"         "Media and Entertainment"        "8742" "United States"  "Smith Micro Software Inc"       "832154" "High Technology" "7372" "United States"    100     9.75 "MA"  1
21535 "ForeSee Results Inc"            "Consumer Products and Services" "8732" "United States"  "Verint Systems Inc"             "92343X" "High Technology" "7373" "United States"    100     64.9 "MA"  1
21535 "TKO Electronics Inc"            "High Technology"                "5064" "United States"  "ExpressPoint Tech Svcs Inc"     "30221I" "High Technology" "7378" "United States"    100       12 "MA"  1
21528 "Hiperos LLC"                    "High Technology"                "7372" "United States"  "Coupa Software Inc"             "22266L" "High Technology" "7372" "United States"    100       95 "MA"  0
21521 "Moore Stephens Consulting Ltd"  "Consumer Products and Services" "8742" "United Kingdom" "Verisk Analytics Inc"           "92345Y" "High Technology" "7374" "United States"    100       87 "IMA" 1
21515 "Exaxe Holdings Ltd"             "High Technology"                "7372" "Ireland-Rep"    "Majesco Inc"                    "56068V" "High Technology" "7372" "United States"     90   12.334 "IMA" 0
21508 "PlanGrid Inc"                   "High Technology"                "7372" "United States"  "Autodesk Inc"                   "052769" "High Technology" "7372" "United States"    100      875 "MA"  0
21503 "Sapho Inc"                      "High Technology"                "7372" "United States"  "Citrix Systems Inc"             "177376" "High Technology" "7372" "United States"    100      200 "MA"  0
21500 "iPass Inc"                      "High Technology"                "7374" "United States"  "Pareteum Corp"                  "69946T" "High Technology" "7371" "United States"    100   21.901 "MA"  1
21496 "Thermal Kinetics Engineering"   "Industrials"                    "8711" "United States"  "RCM Technologies Inc"           "749360" "High Technology" "7376" "United States"    100   10.632 "MA"  1
21493 "Datawatch Corp"                 "High Technology"                "7372" "United States"  "Altair Engineering Inc"         "02137H" "High Technology" "7372" "United States"    100  166.865 "MA"  0
21490 "Martin Healthcare Group"        "Healthcare"                     "8062" "United States"  "Hospitalists Now Inc"           "5C8179" "High Technology" "7372" "United States"    100       25 "MA"  1
21489 "Viewpoint Creative"             "Media and Entertainment"        "8742" "United States"  "Dolphin Ent Inc"                "25686H" "High Technology" "7375" "United States"    100     1.25 "MA"  1
21487 "Reserve Rentals"                "Real Estate"                    "6513" "United States"  "Domio Inc"                      "7H8799" "High Technology" "7372" "United States"    100      1.4 "MA"  1
21483 "Wholesale Inc"                  "Retail"                         "5571" "United States"  "RumbleON"                       "8A6042" "High Technology" "7371" "United States"    100       23 "MA"  1
21480 "SLI Systems Ltd"                "High Technology"                "7375" "New Zealand"    "ESW Holdings Inc"               "6H6485" "High Technology" "7372" "United States"    100   27.261 "IMA" 1
21479 "Symbility Solutions Inc"        "High Technology"                "7372" "Canada"         "CoreLogic Inc"                  "21871D" "High Technology" "7375" "United States" 73.213   82.979 "IMA" 1
21474 "CareSpeak Communs Inc"          "High Technology"                "7372" "United States"  "OptimizeRx Corp"                "68401U" "High Technology" "7372" "United States"    100        9 "MA"  0
21472 "SendGrid Inc"                   "High Technology"                "7372" "United States"  "Twilio Inc"                     "90138F" "High Technology" "7372" "United States"    100 1970.745 "MA"  0
21469 "Rentlytics Inc"                 "High Technology"                "7372" "United States"  "RealPage Inc"                   "75606N" "High Technology" "7372" "United States"    100       57 "MA"  0
21468 "Handy Technologies Inc"         "High Technology"                "7372" "United States"  "ANGI Homeservices Inc"          "00183L" "High Technology" "7372" "United States"    100  164.776 "MA"  0
21460 "RedLock Inc"                    "High Technology"                "7372" "United States"  "Palo Alto Networks Inc"         "697435" "High Technology" "7373" "United States"    100      173 "MA"  1
21460 "Hortonworks Inc"                "High Technology"                "7372" "United States"  "Cloudera Inc"                   "18914U" "High Technology" "7372" "United States"    100 1872.043 "MA"  0
21455 "Blazent Inc"                    "High Technology"                "7372" "United States"  "ServiceNow Inc"                 "81762P" "High Technology" "7372" "United States"    100        9 "MA"  0
21452 "Tapingo Inc"                    "High Technology"                "7372" "United States"  "Grubhub Inc"                    "400110" "High Technology" "7375" "United States"    100      150 "MA"  1
21452 "Fatstax Llc"                    "High Technology"                "7372" "United States"  "Bigtincan Hldg Ltd"             "9E1983" "High Technology" "7371" "United States"    100      1.8 "MA"  1
21447 "Marketo Inc"                    "High Technology"                "7372" "United States"  "Adobe Systems Inc"              "00724F" "High Technology" "7372" "United States"    100     4750 "MA"  0
21437 "Engility Holdings Inc"          "Consumer Products and Services" "8711" "United States"  "Science Applications Intl Corp" "808625" "High Technology" "7373" "United States"    100 2394.912 "MA"  1
21434 "RSI Intl Sys Inc-RoomKeyPMS"    "High Technology"                "7372" "Canada"         "Nsight Inc"                     "6H8246" "High Technology" "7373" "United States"    100    3.501 "IMA" 1
21433 "IntraLinks Holdings Inc"        "High Technology"                "7372" "United States"  "SS&C Technologies Holdings Inc" "78467J" "High Technology" "7372" "United States"    100     1500 "MA"  0
21431 "OpsGenie Inc"                   "High Technology"                "7379" "United States"  "Atlassian Corp Plc"             "1E3877" "High Technology" "7372" "United States"    100      295 "MA"  1
21427 "Mediture LLC"                   "High Technology"                "7372" "United States"  "Tabula Rasa Healthcare Inc"     "9E3754" "High Technology" "7372" "United States"    100   22.454 "MA"  0
21427 "Mach Box Inc"                   "High Technology"                "7372" "United States"  "Veritone Inc"                   "3C1732" "High Technology" "7374" "United States"    100        5 "MA"  1
21412 "CSRA Inc-SE&A BU"               "Industrials"                    "8711" "United States"  "CACI International Inc"         "127190" "High Technology" "7373" "United States"    100       84 "MA"  1
21404 "Cloud Lending Inc"              "High Technology"                "7371" "United States"  "Q2 Holdings Inc"                "74736L" "High Technology" "7372" "United States"    100      105 "MA"  1
21398 "LeaseLabs Inc"                  "High Technology"                "7372" "United States"  "RealPage Inc"                   "75606N" "High Technology" "7372" "United States"    100      117 "MA"  0
21398 "Frame Inc"                      "High Technology"                "7372" "United States"  "Nutanix Inc"                    "67059N" "High Technology" "7372" "United States"    100      165 "MA"  0
21397 "Elauwit Networks LLC"           "High Technology"                "7375" "United States"  "Boingo Wireless Inc"            "09739C" "High Technology" "7375" "United States"    100       43 "MA"  0
21396 "SpringCM Inc"                   "High Technology"                "7372" "United States"  "DocuSign Inc"                   "256163" "High Technology" "7372" "United States"    100      220 "MA"  0
21396 "Eze Software Group LLC"         "High Technology"                "7372" "United States"  "SS&C Technologies Holdings Inc" "78467J" "High Technology" "7372" "United States"    100     1450 "MA"  0
21390 "CQ-Roll Call Inc"               "Media and Entertainment"        "7383" "United States"  "FiscalNote Inc"                 "0E8935" "High Technology" "7374" "United States"    100      180 "MA"  1
21390 "Spookfish Ltd"                  "Industrials"                    "8713" "Australia"      "EagleView Technologies Inc"     "27190X" "High Technology" "7372" "United States" 89.544    71.59 "IMA" 1
21390 "SCVNGR Inc"                     "High Technology"                "7372" "United States"  "Grubhub Inc"                    "400110" "High Technology" "7375" "United States"    100      390 "MA"  1
21390 "MetaPack Ltd"                   "High Technology"                "7372" "United Kingdom" "Stamps.Com Inc"                 "852857" "High Technology" "7375" "United States"    100  230.003 "IMA" 1
21385 "Indus Software Tech Pvt Ltd"    "High Technology"                "7372" "India"          "Ebix Inc"                       "278715" "High Technology" "7372" "United States"    100       29 "IMA" 0
21382 "PeopleDoc Inc"                  "High Technology"                "7371" "United States"  "Ultimate Software Group Inc"    "90385D" "High Technology" "7372" "United States"    100      300 "MA"  1
21376 "Medialab"                       "Media and Entertainment"        "8742" "Peru"           "Altium LLC"                     "02096Z" "High Technology" "7371" "United States"    100        1 "IMA" 1
21376 "The Door LLC"                   "Media and Entertainment"        "8742" "United States"  "Dolphin Ent Inc"                "25686H" "High Technology" "7375" "United States"    100       11 "MA"  1
21367 "StudyBlue Inc"                  "High Technology"                "7375" "United States"  "Chegg Inc"                      "163092" "High Technology" "7375" "United States"    100     20.8 "MA"  0
21363 "Convergys Corp"                 "Consumer Products and Services" "7389" "United States"  "SYNNEX Corp"                    "87162W" "High Technology" "7373" "United States"    100 2379.667 "MA"  1
21363 "RO Innovation Inc"              "High Technology"                "7376" "United States"  "Upland Software Inc"            "91544A" "High Technology" "7372" "United States"    100     12.5 "MA"  1
21362 "Molina Information Systems LLC" "Healthcare"                     "6324" "United States"  "DXC Technology Co"              "23355L" "High Technology" "7371" "United States"    100      231 "MA"  1
21360 "Edgewater Networks Inc"         "High Technology"                "7372" "United States"  "Ribbon Commun Inc"              "5H3530" "High Technology" "7373" "United States"    100      110 "MA"  1
21346 "VictorOps Inc"                  "High Technology"                "7372" "United States"  "Splunk Inc"                     "848637" "High Technology" "7372" "United States"    100      120 "MA"  0
21346 "Adaptive Insights Inc"          "High Technology"                "7372" "United States"  "Workday Inc"                    "98138H" "High Technology" "7374" "United States"    100     1550 "MA"  1
21346 "rplan Ltd"                      "High Technology"                "7376" "United Kingdom" "InvestCloud Inc"                "0E9054" "High Technology" "7372" "United States"    100       20 "IMA" 1
21346 "Penguin Computing Inc"          "High Technology"                "7374" "United States"  "SMART Global Holdings Inc"      "78211X" "High Technology" "7374" "United States"    100       85 "MA"  0
21342 "Artilium PLC"                   "High Technology"                "7372" "United Kingdom" "Pareteum Corp"                  "69946T" "High Technology" "7371" "United States" 92.196   92.351 "IMA" 1
21341 "Wellgood Llc"                   "High Technology"                "7375" "United States"  "Leaf Group Ltd"                 "24802N" "High Technology" "7375" "United States"    100       19 "MA"  0
21341 "BioAnomaly Inc"                 "Healthcare"                     "2834" "United States"  "Freight Solutions Inc"          "35704Z" "High Technology" "7372" "United States"    100   22.351 "MA"  1
21339 "GitHub Inc"                     "High Technology"                "7374" "United States"  "Microsoft Corp"                 "594918" "High Technology" "7372" "United States"    100     7500 "MA"  1
21334 "Dealflo Ltd"                    "High Technology"                "7373" "United Kingdom" "Onespan Inc"                    "92230Y" "High Technology" "7372" "United States"    100   54.329 "IMA" 1
21334 "Evoswitch Netherlands,Global S" "High Technology"                "7374" "Netherlands"    "Iron Mountain Inc"              "462846" "High Technology" "7375" "United States"    100  236.529 "IMA" 1
21329 "FLUX Carbon Corp"               "Financials"                     "6799" "United States"  "Attis Industries Inc"           "114003" "High Technology" "7371" "United States"     80       18 "MA"  1
21329 "Gram Games Teknoloji AS"        "High Technology"                "7372" "Turkey"         "Zynga Inc"                      "98986T" "High Technology" "7372" "United States"    100   241.59 "IMA" 0
21325 "X.commerce Inc"                 "High Technology"                "7375" "United States"  "Adobe Systems Inc"              "00724F" "High Technology" "7372" "United States"    100     1680 "MA"  1
21320 "WriteLab Inc"                   "High Technology"                "7372" "United States"  "Chegg Inc"                      "163092" "High Technology" "7375" "United States"    100       15 "MA"  1
21320 "True North Consulting LLC"      "Consumer Products and Services" "7389" "United States"  "GSE Systems Inc"                "36227K" "High Technology" "7372" "United States"    100     9.75 "MA"  1
21311 "Orion Healthcorp-Revenue Cycle" "High Technology"                "7372" "United States"  "Medical Transcription Billing"  "58464J" "High Technology" "7372" "United States"    100     12.6 "MA"  0
21308 "HealthGrid Corp"                "High Technology"                "7371" "United States"  "Allscripts Healthcare Sol Inc"  "01988P" "High Technology" "7373" "United States"    100      110 "MA"  1
21308 "Avsi Grp Llc"                   "High Technology"                "7373" "United States"  "Conference Technologies Inc"    "4H1160" "High Technology" "7373" "United States"    100    2.375 "MA"  0
21307 "Vendor Team Services Inc"       "High Technology"                "7374" "United States"  "Innospire Sys Corp"             "4H5692" "High Technology" "7371" "United States"    100     1.35 "MA"  1
21305 "Cloud Savings Co Ltd"           "High Technology"                "7372" "United Kingdom" "Groupon Inc"                    "399473" "High Technology" "7375" "United States"    100   65.003 "IMA" 1
21304 "Sage Data Security LLC"         "Consumer Products and Services" "8748" "United States"  "Tyler Technologies Inc"         "902252" "High Technology" "7372" "United States"    100     11.5 "MA"  1
21300 "Weebly Inc"                     "High Technology"                "7374" "United States"  "Square Inc"                     "85198Q" "High Technology" "7372" "United States"    100      365 "MA"  1
21294 "ClickPay LLC"                   "High Technology"                "7372" "United States"  "RealPage Inc"                   "75606N" "High Technology" "7372" "United States"    100    218.5 "MA"  0
21284 "Secdo Ltd"                      "High Technology"                "7379" "Israel"         "Palo Alto Networks Inc"         "697435" "High Technology" "7373" "United States"    100      100 "IMA" 1
21277 "Red Sky Solutions LLC"          "High Technology"                "7373" "United States"  "Presidio Inc"                   "74102M" "High Technology" "7376" "United States"    100   40.731 "MA"  1
21277 "Centrumdirect Ltd"              "Financials"                     "6099" "India"          "Ebix Inc"                       "278715" "High Technology" "7372" "United States"    100      175 "IMA" 1
21274 "Study Abroad Apartments-Assets" "High Technology"                "7372" "United States"  "Roomi Inc"                      "5F8161" "High Technology" "7372" "United States"    100      2.3 "MA"  0
21265 "InterFAX Communications Ltd"    "High Technology"                "7375" "Ireland-Rep"    "Upland Software Inc"            "91544A" "High Technology" "7372" "United States"    100   37.001 "IMA" 1
21265 "Sigma Designs Inc-Smart Tv &"   "Telecommunications"             "3663" "United States"  "V Silicon Inc"                  "5H3579" "High Technology" "7372" "United States"    100        5 "MA"  1
21263 "MuleSoft Inc"                   "High Technology"                "7372" "United States"  "Salesforce.com Inc"             "79466L" "High Technology" "7372" "United States"    100 6744.086 "MA"  0
21259 "Alithya Consulting Inc"         "High Technology"                "8748" "Canada"         "Edgewater Technology Inc"       "280358" "High Technology" "7376" "United States"    100  162.142 "IMA" 1
21257 "Wipro Ltd-Hosted Data Ctr"      "High Technology"                "7372" "United States"  "Ensono LP"                      "8E6590" "High Technology" "7376" "United States"    100      405 "MA"  1
21257 "Evident.io Inc"                 "High Technology"                "7373" "United States"  "Palo Alto Networks Inc"         "697435" "High Technology" "7373" "United States"    100      300 "MA"  0
21255 "Netsil Inc"                     "High Technology"                "7376" "United States"  "Nutanix Inc"                    "67059N" "High Technology" "7372" "United States"    100   69.926 "MA"  1
21255 "Booker Software Inc"            "High Technology"                "7371" "United States"  "MINDBODY Inc"                   "60255W" "High Technology" "7374" "United States"    100      150 "MA"  1
21255 "Etouch Sys Corp"                "High Technology"                "7373" "United States"  "Virtusa Corp"                   "92827P" "High Technology" "7371" "United States"    100      140 "MA"  1
21251 "KeyPoint Government Solutions"  "Consumer Products and Services" "7382" "United States"  "DXC Technology Co"              "23355L" "High Technology" "7371" "United States"    100   112.98 "MA"  1
21251 "Vencore Holding Corp"           "Financials"                     "6799" "United States"  "DXC Technology Co"              "23355L" "High Technology" "7371" "United States"    100  885.145 "MA"  1
21250 "ABILITY Network Inc"            "High Technology"                "7376" "United States"  "Inovalon Holdings Inc"          "45781D" "High Technology" "7374" "United States"    100     1200 "MA"  1
21244 "ECS Prepaid LLC-Certain Assets" "High Technology"                "7372" "United States"  "Gopher Protocol Inc"            "0H3746" "High Technology" "7372" "United States"    100     4.58 "MA"  0
21242 "Phantom Cyber Corp"             "High Technology"                "7372" "United States"  "Splunk Inc"                     "848637" "High Technology" "7372" "United States"    100      350 "MA"  0
21236 "Sphere 3d Corp-Data"            "High Technology"                "7374" "Canada"         "Silicon Valley Technology Part" "2H4162" "High Technology" "7372" "United States"    100    35.59 "IMA" 1
21230 "Soft Co Sas"                    "High Technology"                "7376" "France"         "CTG"                            "205477" "High Technology" "7373" "United States"    100   20.539 "IMA" 1
21229 "Launch Digital Marketing LLC"   "Media and Entertainment"        "8742" "United States"  "Cars.com Inc"                   "77625C" "Retail"          "7374" "United States"    100      205 "MA"  1
end
format %td DateAnnounced