Hi, I am wanting to seperate out client names from a lengthy bit of text based on keywords that they come after. The code that I have been using in dev is below: data have; infile cards truncover; input have_str $500.; cards; Firm A advises on the Volkswagen settlement with US authorities regarding emissions from diesel engines Firm A advises The Carlyle Group on its $3.2bn acquisition of Atotech advising Coca Cola ; run; data want; set have; retain _prxid; /*advised*/ if _n_=1 then _prxid=prxparse('/(\badvised)[^A-Z]{0,10}(([A-Z]\w+\s*\b)+)/'); if prxmatch(_prxid, have_str) then do; client1=prxposn(_prxid, 2, have_str); end;; /*advises*/ if _n_=1 then _prxid=prxparse('/(\badvises)[^A-Z]{0,10}(([A-Z]\w+\s*\b)+)/'); if prxmatch(_prxid, have_str) then do; client2=prxposn(_prxid, 2, have_str); end;; /*advising*/ if _n_=1 then _prxid=prxparse('/(\badvising)[^A-Z]{0,10}(([A-Z]\w+\s*\b)+)/'); if prxmatch(_prxid, have_str) then do; client3=prxposn(_prxid, 2, have_str); end;; run; There are multiple keywords such as "advising" or "advised" that I'm interested in. When the same keyword "advises" appears more than once in the same sentence then the data isn't populated. Any ideas please?
... View more