From the course: SAS® 9.4 Cert Prep: Part 10 Manipulating Data with Functions

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Searching for character strings

Searching for character strings

- [Instructor] The find function is an effective way to search for a particular substring within character values. The first argument typically is the character column and the second argument specifies the substring to find. The optional third argument can be used to provide modifiers. I makes the search case insensitive and T trims leading and trailing blanks. The find function returns a number that indicates the start position of the substring within the string. If the substring is not found, the find function returns a zero. Let's look at this example. The find function does a case-sensitive search in the values of Station for the substring Airport. The numeric value the function returns is assigned to a new column, AirportLoc.

Contents