Functions and CALL Routines |
Searches a character expression for any of the specified characters,
and returns the position of that character.
Category: |
Character
|
Restriction: |
I18N Level 0
|
Tip: |
DBCS equivalent function is KINDEXC in
SAS National Language Support (NLS): Reference Guide.
|
INDEXC(source,excerpt-1<,...
excerpt-n>)
|
-
source
-
specifies a character constant, variable,
or expression to search.
-
excerpt
-
specifies the character constant, variable,
or expression to search for in source.
Tip: |
If you specify more than
one excerpt, separate them with a comma. |
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.
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 substring. The FINDC function provides more options.
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
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.