Operators
List Creation Operator: [ ]
[ item1, item2, …, item_n ];
[ #name1=item1, #name2=item2, …, #name_n=item_n ];
The list creation operator creates a list. The items, which must be separated by commas, can be any valid SAS/IML data type, such as matrices, tables, and other lists. You can also use expressions or function calls inside the brackets. Some or all of the items can be empty.
Optionally, you can assign names to the items in the list by specifying a name-value pair. The name must be prefixed by the # symbol. The name must be a character literal, either quoted or unquoted. The following statements are valid ways to specify lists:
numMat = 1:4;
charMat = {"X" "Y" "Z"};
list = [100, "Q"]; /* simple list */
L1 = [1, "a", numMat, charMat, list]; /* multiple types in list */
L2 = [1, , 1:3, ]; /* 2nd and 4th items empty */
L3 = [#N=numMat, #C=charMat]; /* named items */
L4 = [#N=numMat, #E= , charMat]; /* some named items */
L5 = [#"Numeric Matrix"=numMat, #"Char Matrix"=charMat]; /* quoted names */
Last updated: March 08, 2024