Chapter Contents |
Previous |
Next |
%INDEX |
Type: | Macro function |
Syntax | |
Details | |
Example | |
Locating a Character |
Syntax |
%INDEX (source,string) |
Details |
The %INDEX function searches source for the first occurrence of string and returns the position of its first character. If string is not found, the function returns 0.
Example |
The following statements find the first character
V
in a string:
%let a=a very long value; %let b=%index(&a,v); %put V appears at position &b..;
Executing these statements writes to the SAS log:
V appears at position 3.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.