this solution increased the number of matched items. however, my main data has 3000 items, after applying the code you shared, 2300 items are merged using the code below: proc sql; create table MA4 as select MA2.*, MA3.* from MA2 inner join Zeynep.Dsenames as MA3 on MA2.Date_Announced between MA3.NAMEDT and MA3.NAMEENDT and strip(MA2.Acquiror_6digit_CUSIP) = upcase(substr(strip(MA3.NCUSIP),1,6)) ; quit; To see which items are not matched I use the code below: proc sql; create table Unmatched_MA3 as select MA2.Acquiror_6digit_CUSIP, MA2.Date_Announced, MA2.Acquiror_Full_Name from MA2 left join MA3 on MA2.Acquiror_6digit_CUSIP = MA3.NCUSIP where MA3.NCUSIP is missing; quit; this results in 800 observations. I would expect that the number of observations in matched and unmatched datasets would sum up to 3000. Instead of getting a merged and unmatched output, can I change the below code some way that unmatched items are displayed as missing: proc sql; create table MA4 as select MA2.*, MA3.* from MA2 inner join Zeynep.Dsenames as MA3 on MA2.Date_Announced between MA3.NAMEDT and MA3.NAMEENDT and strip(MA2.Acquiror_6digit_CUSIP) = upcase(substr(strip(MA3.NCUSIP),1,6)) ; quit; Thank you
... View more