Chapter Contents |
Previous |
Next |
SETITEMC, SETITEML, SETITEMN, and SETITEMO |
Category: | List |
Syntax | |
Details | |
See Also |
Syntax |
rc=SETITEMC(list-id,cval<,index<,autogrow>>); |
rc=SETITEML(list-id,sublist-id<,index<autogrow>>); |
rc=SETITEMN(list-id,nval<,index<,autogrow>>); |
rc=SETITEMO(list-id,object-id<,index<,autogrow>>); |
Type: Numeric
Type: Numeric or List
Type: Character
Type: Numeric
Type: Numeric or Object
Type: Numeric
'N' |
The size of the list cannot change. (This is the default.) |
'Y' |
The size of the list can increase to accommodate a new item that is being added to the list. The list expands only if index is greater than the current number of items in the list and the list does not have the FIXEDLENGTH attribute. |
Type: Character
Details |
Using SETITEMC, SETITEML, SETITEMN, or SETITEMO is analogous to assigning a character, a sublist identifier, a numeric value, or an object identifier, respectively, to an indexed item in an array. Index specifies the position in the list of the item whose value is assigned. If autogrow is Y , then index can be greater than the length of the list. These functions then expand the list to a total of index items. They also set all other new items to missing values, and they place the new value into the list. These functions can add items only to the end of a list. Use INSERTC, INSERTL, INSERTN, or INSERTO to insert values elsewhere in a list.
SETITEMC, SETITEML, SETITEMN, and SETITEMO replace an existing item in a list and even change its type unless the item or the list has the FIXEDTYPE attribute.
SETITEMC, SETITEML, SETITEMN, and SETITEMO do not make a copy of the list before assigning the new item. The list is modified in place.
Note: The return value of these functions is not used
to indicate whether an error has been detected. When an error occurs, the
program simply halts.
An error condition results
list=setitemc(list,'abc',4);
To check the attributes of a list or list item, use HASATTR. To change attributes, use SETLATTR.
See Also |
GETITEMC, GETITEML, GETITEMN, and GETITEMO
INSERTC, INSERTL, INSERTN, and INSERTO
SETNITEMC, SETNITEML, SETNITEMN, and SETNITEMO
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.