September 2019
Beginner to intermediate
346 pages
7h 35m
English
CHOOSEC and CHOOSEN are functions that help us to select a single value from multiple observations. The CHOOSEC (for character variables) and CHOOSEN (for numeric variables) functions come in handy when you want to use macros.
The first argument is the index value. There is no limit to the arguments supplied. For instance, in the following examples, we used up to six arguments:
|
SAS Statement |
Results |
|
Choosen (5, 1, 4, 5, 6, 8); |
8 |
|
Choosec (-1, “A”, “B”, “C”); |
C |
|
Choosec (3, “A”, “B”, “C”); |
C |
Unlike the WHICHC or WHICHN functions, the result that's produced by CHOOSEC and CHOOSEN is not always numeric. It is numeric for CHOOSEN and a character type for CHOOSEC. However, the index value is always ...
Read now
Unlock full access