I am attempting to find the location of a word within a string, not the character position, but where in the string the word appears. For example, the following code: data example;
input string $50.;
word = 'word';
position = find(string, word);
datalines;
This is a sample string containing the word.
Another example without the keyword.
The word appears here.
;
run; Has the output of However, the position I am seeking is: OBS1 position 8 OBS2 position 0 OBS3 position 2 Reason being the actual data will have wildcards scattered within the string that could be replaced with any number of characters and this value will later be used in a scan function to find specific matches in a delimited variable value. Hope that makes sense...
... View more