INDEX Function


Searches a character expression for a string of characters

Category: Character

Syntax

INDEX ( source,excerpt )

Arguments

source

  • specifies the character expression to search.

excerpt

  • specifies the string of characters to search for in the character expression.

  • Tip: Enclose a literal string of characters in quotation marks.

Details

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.

Examples

SAS Statements

Results

  a='ABC.DEF (X=Y)';   b='X=Y';   x=index(a,b);   put x;  
  10  

See Also

Functions:

  • 'INDEXC Function' on page 590

  • 'INDEXW Function' on page 591




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net