Returns a numeric value that represents the results of choosing from a list of arguments
Category: Character
CHOOSEN ( index-expression , selection-1 < , selection-n >)
index-expression
specifies a numeric expression.
selection
specifies a numeric expression that is returned.
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.
The CHOOSEN function is similar to the CHOOSEC function except that CHOOSEN returns a numeric value while CHOOSEC returns a character value.
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
Functions:
'CHOOSEC Function' on page 435