Miscellaneous String Functions

Don't be put off by the “miscellaneous” in this heading. Many of these functions are extremely useful; they just didn't fit neatly into categories.

Function:   CHOOSEC

Purpose:    To select a character value from a list of character values (supplied as the 2nd to nth arguments of the function)

Syntax:      CHOOSEC(item-number, value-1<, value-2, …>)

item-number selects which item to return from the list of values. If the value is negative, counting starts at the end of the list.

value-n are character values from which to choose.

If the length of the resulting character value has not been defined, it will be assigned a length of 200.

Examples:

For these examples, Name1 = “Fred”, Name2 = ”Harriet”, Name3 = ”Joyce” ...

Get SAS Functions by Example, Second Edition, 2nd Edition 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.