Chapter Contents

Previous

Next
GETITEMC, GETITEML, GETITEMN, and GETITEMO

GETITEMC, GETITEML, GETITEMN, and GETITEMO



Returns a value that is identified by its position in an SCL list

Category: List


Syntax
Details
Examples
Example 1: Using the GETITEMC Function
Example 2: Using the GETITEML Function
Example 3: Using the GETITEMN Function
Example 4: Using the GETITEMO Function
See Also

Syntax

cval=GETITEMC(list-id<,index>);
sublist-id=GETITEML(list-id<,index>);
nval=GETITEMN(list-id<,index>);
object-id=GETITEMO(list-id<,index>);

cval
contains the character value (returned by GETITEMC) of the item that is stored at the specified position in list identified by list-id.

Type: Character

sublist-id
contains the list identifier (returned by GETITEML) of the sublist that is stored at the specified position in the list identified by list-id.

Type: Numeric

nval
contains the numeric value (returned by GETITEMN) of the item that is stored at the specified position in the list identified by list-id.

Type: Numeric

object-id
contains the object identifier (returned by GETITEMO) of the object that is stored at the specified position in the list identified by list-id.

Type: Numeric

list-id
contains the identifier of the list that you want to query. An invalid list-id produces an error condition.

Type: Numeric or List

index
is the position in the list of the item to return. The position can be specified as a positive or negative number. By default, index is 1 (the first item). If index is a positive number, then the item is at position index from the beginning of the list. If index is a negative number, then the item is at position ABS(index) from the end of the list. An error condition results if the absolute value for index is zero or if it is greater than the number of items in the list.

Type: Numeric


Details

An error results if you use any of these functions to return an indexed item that has a different data type. You can determine the data type of an item in a list by using ITEMTYPE before using GETITEMC, GETITEML, GETITEMN, or GETITEMO.


Examples

Example 1: Using the GETITEMC Function

Return the character values stored in the first and third items of the list identified by the MYLIST variable:

citem=getitemc(mylist);
citem=getitemc(mylist,3);

Example 2: Using the GETITEML Function

Return the list identifier stored in the eighth item of the list identified by the MYLIST variable:

slist=getiteml(mylist,8);

Example 3: Using the GETITEMN Function

Return the numeric value stored in the fifth item of the list identified by the MYLIST variable:

nitem=getitemn(mylist,5);

Example 4: Using the GETITEMO Function

Return the object identifiers stored in the third and ninth item of the list identified by the MYLIST variable:

sublist=getitemo(mylist,3);
oitem=getitemo(mylist,9);

See Also

GETNITEMC, GETNITEML, GETNITEMN, and GETNITEMO

POPC, POPL, POPN, and POPO

SETITEMC, SETITEML, SETITEMN, and SETITEMO


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.