Returns the character position of a word in a string, or returns the number of the word in a string.
Category: | Character |
is a character constant, variable, or expression that specifies the character string to be searched.
is a character constant, variable, or expression that specifies the word to be searched.
is an optional character constant, variable, or expression that initializes a list of characters.
is an optional numeric constant, variable, or expression with an integer value that specifies the position at which the search should begin and the direction in which to search.
specifies a character constant, variable, or expression in which each non-blank character modifies the action of the FINDW function.
is ignored.
adds alphabetic characters to the list of characters.
scans from right to left instead of from left to right, regardless of the sign of the startpos argument.
adds control characters to the list of characters.
adds digits to the list of characters.
counts the words that are scanned until the specified word is found, instead of determining the character position of the specified word in the string. Fragments of a word are not counted.
adds an underscore and English letters (that is, the characters that can begin a SAS variable name using VALIDVARNAME=V7) to the list of characters.
adds graphic characters to the list of characters.
adds a horizontal tab to the list of characters.
ignores the case of the characters.
causes all characters that are not in the list of characters to be treated as delimiters. If K is not specified, then all characters that are in the list of characters are treated as delimiters.
adds lowercase letters to the list of characters.
specifies that multiple consecutive delimiters, and delimiters at the beginning or end of the string argument, refer to words that have a length of zero.
adds digits, an underscore, and English letters (that is, the characters that can appear after the first character in a SAS variable name using VALIDVARNAME=V7) to the list of characters.
processes the chars and modifier arguments only once, rather than every time the FINDW function is called. Using the O modifier in the DATA step (excluding WHERE clauses), or in the SQL procedure, can make FINDW run faster when you call it in a loop where the chars and modifier arguments do not change.
adds punctuation marks to the list of characters.
ignores delimiters that are inside of substrings that are enclosed in quotation marks. If the value of the string argument contains unmatched quotation marks, then scanning from left to right will produce different words than scanning from right to left.
removes leading and trailing delimiters from the word argument.
adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, and form feed) to the list of characters.
trims trailing blanks from the string, word, and chars arguments.
adds uppercase letters to the list of characters.
adds printable characters to the list of characters.
adds hexadecimal characters to the list of characters.
data _null_; result = findw('At least 2.5 meters of rain falls in a rain forest.', 'rain', ' ', 25); put result=; run;
data _null_; string='Artists from around the country display their art at an art festival.'; result=findw(string, 'Art',' ', 'i', 10); put result=; run;
data _null_; string='Artists from around the country display their art at an art festival.'; result=findw(string, 'art',' ','E',50); put result=; run;
data _null_; string='The Great Himalayan National Park was created in 1984. Because of its terrain and altitude, the park supports a diversity of wildlife and vegetation.'; result=findw(string,'park',' ','I E'); put result=; run;