Statistical Analysis System (SAS) Programming Certification Practice Exam

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the SAS Programming Certification Exam with our comprehensive quiz. Study with multiple-choice questions, detailed explanations, and helpful hints to boost your confidence. Ace your certification test!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What function is used to find the position of a substring within a string in SAS?

  1. SUBSTR

  2. INDEX

  3. FIND

  4. POSITION

The correct answer is: INDEX

The function used to find the position of a substring within a string in SAS is INDEX. This function searches for the specified substring within a given string and returns the starting position of the first occurrence of that substring. If the substring is not found, INDEX will return zero. Using INDEX is straightforward. For instance, if you want to find where "cat" appears in the string "The cat sat on the mat," calling INDEX with these parameters would yield a number representing the first position of "cat" in the string. While SUBSTR is useful for extracting a portion of a string based on specified starting positions and lengths, it does not perform searches. FIND is similar to INDEX, but it is used in SAS to search for a substring as well, though it has more options for case sensitivity and other parameters. POSITION isn't a recognized function in SAS for this purpose. Hence, INDEX stands out as the correct function to locate the starting position of a substring within a string.