Previous Page | Next Page

SAS Component Language Dictionary

MAKENLIST



Creates an SCL list that contains named items
Category: List

Syntax
Details
Example
See Also

Syntax

list-id=MAKENLIST(visibility,name-1<, . . . ,name-n>);

list-id

contains the identifier of the new list, or 0 if the list could not be created.

Type: Numeric or List

visibility

specifies whether the list is global or local:

'G'

The list is global and can be shared by all applications executing in the same SAS session. A global list is deleted when the SAS session ends.

'L'

The list is local to the current SAS application. A local list is deleted when the application ends. (This is the default.)

Type: Character

name

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.

Type: Character


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

LISTLEN

MAKELIST

NAMEDITEM

NAMEITEM

Previous Page | Next Page | Top of Page