@Aman4SAS wrote:
Can we use string as delimiter.
like . scan(word,"AND",1);
See it this gives you enough to get started.
data example;
x="This is a phrase with the word and embedded";
newx = tranwrd(x,' and ','+');
y=scan(newx,1,'+');
run;
The spaces around the ' and ' are there to get and as word so it does not get replaced inside words like "sand".
Use a character such as the + that 1) will not appear in your data and 2) is not a normal delimiter for the scan function so you get breaks where you expect it.
TRANWRD function is case sensitive. You may need either multiple passes through TRANWRD if you need " And " as well as " and " " AND " and so forth. Or UPCASE or LOWCASE the whole string.
... View more