Hi, I have run the code (please see below) data have;
input = "CRH PLC TO BID FOR PPC LTD";
run;
data want;
set have;
temp=input;
p=prxmatch('/\b(TO BID)\b/i',temp);
do while(p);
temp=substr(temp,p);
temp=substr(temp,findc(temp,' ')+1);
Buy=catx(' ',scan(temp,1,' '),scan(temp,2,' '),scan(temp,3,' '),scan(temp,4,' '));
p=prxmatch('/\b(TO BID)\b/i',temp);
end;
drop temp p;
run; which uses an anchor word "TO BID" and brings back exactly the data I require after the anchor which is "BID FOR PPC LTD" Do you happen to know how I can reverse this and take words before the anchor word "TO BID" ? I am wanting to obtain the text "CRH PLC TO BID" Thanks Chris
... View more