can anybody tell me the difference between find() and index() giving an example.
find() -
"The FIND function searches string for the first occurrence of the specified substring, and returns the position of that substring. If the substring is not found in string, FIND returns a value of 0.
If startpos is not specified, FIND starts the search at the beginning of the string and searches the string from left to right.
If startpos is specified, the absolute value of startpos determines the position at which to start the search.
The sign of startpos determines the direction of the search."
index() -
Syntax |
INDEX(source,excerpt) |
"The INDEX function searches source, from left to right, for the first occurrence of the string specified in excerpt, and returns the position in source of the string's first character. If the string is not found in source, INDEX returns a value of 0.
If there are multiple occurrences of the string, INDEX returns only the position of the first occurrence."
find() -
"The FIND function searches string for the first occurrence of the specified substring, and returns the position of that substring. If the substring is not found in string, FIND returns a value of 0.
If startpos is not specified, FIND starts the search at the beginning of the string and searches the string from left to right.
If startpos is specified, the absolute value of startpos determines the position at which to start the search.
The sign of startpos determines the direction of the search."
index() -
Syntax |
INDEX(source,excerpt) |
"The INDEX function searches source, from left to right, for the first occurrence of the string specified in excerpt, and returns the position in source of the string's first character. If the string is not found in source, INDEX returns a value of 0.
If there are multiple occurrences of the string, INDEX returns only the position of the first occurrence."
thank you sir
So don't leave this topic hanging. Mark the solution response, however "trivial".
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.