SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
CHOOSEN Function
Returns a numeric value that represents the results of choosing from a list of arguments
Category: Character
Syntax
CHOOSEN ( index-expression , selection-1 < , selection-n >)
Arguments
index-expression
-
specifies a numeric expression.
selection
-
specifies a numeric expression that is returned.
Details
The CHOOSEN function uses the value of index-expression to select from the arguments that follow. For example, if index-expression is 3, CHOOSEN returns the value of selection-3 . If the first argument is negative, the function counts backwards from the list of arguments, and returns that value.
Comparisons
The CHOOSEN function is similar to the CHOOSEC function except that CHOOSEN returns a numeric value while CHOOSEC returns a character value.
Examples
The following example shows how CHOOSEN chooses from a series of values:
data _null_; ItemNumber=choosen(5,100,50,3784,498,679); Rank=choosen(-2,1,2,3,4,5); Score=choosen(3,193,627,33,290,5); Value=choosen(-5,-37,82985,-991,3,1014,-325,3,54,-618); put ItemNumber= Rank= Score= Value=; run;
SAS writes the following line to the log:
ItemNumber=679 Rank=4 Score=33 Value=1014
See Also
Functions:
-
'CHOOSEC Function' on page 435