INDEXC Function


Searches a character expression for specific characters

Category: Character

Syntax

INDEXC ( source,excerpt-1 <, excerpt-n >)

Arguments

source

  • specifies the character expression to search.

excerpt

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

  • Tip: If you specify more than one excerpt, separate them with a comma.

Details

The INDEXC function searches source , from left to right, for the first occurrence of any character present in the excerpts and returns the position in source of that character. If none of the characters in excerpt-1 through excerpt-n in source are found, INDEXC returns a value of 0.

Comparisons

The INDEXC function searches for the first occurrence of any individual character that is present within the character string, whereas the INDEX function searches for the first occurrence of the character string as a pattern.

Examples

SAS Statements

Results

  a='ABC.DEP (X2=Y1)';   x=indexc(a,'0123',';()=.');   put x;  
  4  
  b='have a good day';   x=indexc(b,'pleasant','very');   put x;  
  2  

See Also

Functions:

  • 'INDEX Function' on page 589

  • '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