Command Reference : String and Date Function Reference
  
 
@rinstr
Find substring position.
Syntax: @rinstr(str1, str2[, n])
str1: string
str2: string
n: (optional) integer
Return: integer
Starting at the end of the string and searching in reverse, finds the starting position of the target string str2 in the string str1. By default, the function returns the location of the last (first from the end) instance of str2 in str1, but you may provide the optional integer n to change the occurrence.
If the target string is not found, @rinstr will return a 0.
Examples
string sval = "1.2341534"
@rinstr("1.2341534", "34")
@instr(sval, "34")
return the value 4, since the substring “34” appears a second time (from the end of the string) beginning in the fourth character of the base string.
If ALPHA1 is an alpha series,
series strfind = @rinstr(alpha1, "34")
fills the series with the last location (first from the end of the string) of the string “34” in each string in ALPHA1, for each observation in the workfile sample.
Cross-references
See also @instr for finding substrings starting from the beginning of the string, and @mid for extracting substrings.