I have a column of firm names, where each firm has several departments (for example different series of one investment fund) and each of those department has a separate string of names. The names of one company's departments only differ lightly in the end, with completely random lengths and structure. I would like to merge all those observations into one representative observation for the whole company. Precisely, I'd like to remove the words like "*something* series" or "series *something*" (please see the sample data I included following). Maybe some way to remove the last 2 whole words in the name. While I suppose I can make a new variable that consists a string of the first several characters of the name and take 'last.name', the names won't be of correct length. Here is the sample of my data. I have more than 150,000 lines like this so brute force method is a very willing NO. I would really appreciate any suggestions, as I have been squeezing my brain 2 3 days now. Thank you very much in advance. Data I have: AGF Dividend Income Fund MF Series AGF Dividend Income Fund Series D AGF Dividend Income Fund Series F AGF Dividend Income Fund Series V Anchor Managed High Income Fund Class A 220 Anchor Managed High Income Fund Class F 221 BMO Dividend Class Advisor Series BMO Dividend Class Series A BMO Dividend Class Series H BMO Dividend Fund Advisor Series BMO Dividend Fund Series A BMO Dividend Fund Series D BMO Dividend Fund Series F BMO Dividend Fund Series F6 BMO Dividend Fund Series T5 BMO Enhanced Equity Income Fund Advisors Series BMO Enhanced Equity Income Fund Series A BMO Enhanced Equity Income Fund Series D BMO Enhanced Equity Income Fund Series F BMO GDN Dividend Growth Fund Class F5 BMO GDN Dividend Growth Fund Class T5 BMO Growth and Income Fund Advisor Series BMO Growth and Income Fund Classic Series BMO Growth and Income Fund Series F BMO Growth and Income Fund Series T5 BMO Growth and Income Fund Series T8 BMO Monthly High Income Fund II Advisor Series BMO Monthly High Income Fund II Series A BMO Monthly High Income Fund II Series D BMO Monthly High Income Fund II Series F BMO Monthly High Income Fund II Series T5 BMO Monthly High Income Fund II Series T8 Beutel Goodman Canadian Dividend Fund Class B Beutel Goodman Canadian Dividend Fund Class D Beutel Goodman Canadian Dividend Fund Class F Beutel Goodman Canadian Dividend Fund Class I Data I want: AGF Dividend Income Fund Anchor Managed High Income Fund BMO Dividend Class BMO Dividend Fund BMO Enhanced Equity Income Fund BMO GDN Dividend Growth Fund BMO Growth and Income Fund BMO Monthly High Income Fund II Beutel Goodman Canadian Dividend Fund
... View more