Dear Statalist users,

The past few days I have been trying to accomplish something, which I till now haven't succeeded with. I hope that you can guide me in the right direction with your expertise.

I have the following database, which contains information about the composition of boards of firms, over several years. Let us call this dataset1.
Code:
input str12 ISIN str4 Year long DirectorID double GenderRatio
"AN9225711045" "2008"  796988 .889
"AN9225711045" "2008"  797030 .889
"AN9225711045" "2008"  797004 .889
"AN9225711045" "2008"  797036 .889
"AN9225711045" "2008"  797010 .889
"AN9225711045" "2008"  797026 .889
"ANN2879J1070" "2010" 1139247 .875
"ANN4327C1220" "2002"   11445 .875
"ANN4327C1220" "2002"   11728 .875
"ANN4327C1220" "2016"  203384    1
"ANN4327C1220" "2017"   90627    1
"ANN4327C1220" "2017"   16795    1
"ANN4327C1220" "2017"  203384    1
end
I also have a database that contains firms that engaged in M&As. Here, we can find firms that have initiated a bid. Sometimes, alongside the bid, the deal value is also stated. Let us call this dataset 2.
Code:
input str12 AcquirorISINnumber str4 Year str17 DealvaluethEUR
"NL0011333752" "2008" "61,900,000.00*"
"AN9225711045" "2011" "32,155,000.00*"
"IT0000072618" "2008" "61,900,000.00*"
"IT0000072618" "2009" ""
"IT0000072618" "2010" ""      
"ANN4327C1220" "2002" "22,277,952.64*"
end
What I want to accomplish is the following. I want to create a dummy variable in dataset1 (the one with the board information), which takes the value of 1 if an M&A bid is initiated in a given firm (ISIN) and year and 0 if no bid is initiated. I think this can be accomplished if the same ISIN and year is found in dataset2 (the one with M&A information). Alongside that, I want to create a new variable that takes the deal value, if that is reported.

Although I think the latter can be achieved by a merge, I do not know how to accomplish the dummy variable between two datasets. Can anyone guide me in the right direction or knows how to do this?

Thank you for your time and efforts.