I found a solution for a) and b), except for the parentheses:
Code:
gen Instrument="" replace first = ustrregexs(0) if ustrregexm(CompanyInstrument, "[\d+\s?\d+?\s?/?\d+?\s?]+%.*") gen Company = subinstr(CompanyInstrument, first, "", .) gen Instrument2 = "" foreach w in Cum. Pref. { replace Instrument2 = Instrument2 + "`w' " if strpos(Company, "`w'") } gen Instrument_final = Instrument + Instrument2
Comment