The Scan function

Unless you can successfully identify a part of the string successfully, replacement or modification of the string value is impossible. In the following code block, we will review some functions that help in string identification:

Data Cities;Input City $50.;First=Scan(City, +1);Last=Scan(City,-1);Third=Scan(City,4);Datalines;Chicago Paris London Geneva Dublin;

The following output shows the words identified from the given string:

The First and the Last words in the string are identified using the positive and negative count. The positive count looks for the first instance of a word in a string from left to right. A negative ...

Get Hands-On SAS for Data Analysis now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.