SAS Component Language Dictionary |
Category: | List |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
list-id=MAKENLIST(visibility,name-1<, . . . ,name-n>); |
contains the identifier of the new list, or 0 if the list could not be created.
specifies whether the list is global or local:
is one or more list item names, separated by commas. Item names are converted to uppercase, and trailing blanks are removed. Each name can be any SCL string. The same name can be used more than once. The maximum length of an SCL list item name is 255 characters.
Details |
MAKENLIST creates a list that contains an item for each name that you specify. Each item contains a missing value. Use the list identifier returned by MAKENLIST with all remaining functions that manipulate the list. When you create a list of named items, you can assign or access list values by their names as well as by their positions. However, it is more efficient to access items by position rather than by name.
You can use MAKENLIST to create structures that group related information into one list. For example, a row in a SAS table can be placed in a named list where each named item corresponds to the table column of the same name.
Note that the visibility argument (L or G) is required and is the first argument, unlike the MAKELIST function. Note also that this function does not use an n argument.
Using MAKENLIST is simpler than using MAKELIST and then naming each item independently.
Example |
The following statement creates a list of four named items:
mylist=makenlist('L','A','B','C');
It is equivalent to these four statements:
mylist=makelist(3,'L'); rc=nameitem(mylist,1,'A'); rc=nameitem(mylist,2,'B'); rc=nameitem(mylist,3,'C');
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.