⚡ Quick Distinction (TL;DR)

• INDEX(string, 'CAT') searches for the entire word / substring 'CAT' in that exact sequence.
• INDEXC(string, 'C', 'A', 'T') searches for the first occurrence of ANY individual character (either 'C', 'A', or 'T').

Comparison by Example

Suppose you have a text variable containing the company name: text = "ACTUATOR";

DATA work.compare;
    text = "ACTUATOR";
    
    /* Look for the sequence 'CAT' */
    pos_index  = index(text, 'CAT');   /* Returns 0 (not found) */
    
    /* Look for any character 'C', 'A', or 'T' */
    pos_indexc = indexc(text, 'CAT');  /* Returns 1 (finds 'A' at position 1) */
RUN;
Function Target Search Match Type Result on "ACTUATOR"
INDEX 'CAT' Exact Substring 0 (No Match)
INDEXC 'CAT' Any Individual Character 1 (Found 'A')

Master Advanced SAS Functions & Data Processing

Elevate your programming skills with comprehensive character, numeric, date, and macro string manipulation lessons.

Explore SAS Programming Mastery →