O'Reilly logo

SAS Functions by Example, Second Edition, 2nd Edition by Ron Cody

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required