SAS Component Language Dictionary |
Category: | List |
Syntax | |
Details | |
Examples | |
Example 1: Clearing a List That Has a Particular Attribute | |
Example 2: Determining Whether a List Item Has a Particular Attribute | |
See Also |
Syntax |
rc=HASATTR(list-id,attribute<,index>); |
contains the return code for the operation:
1 | |
0 |
is the identifier of the list that HASATTR searches. An invalid list-id produces an error condition.
is an attribute for a list or list item, as described in SETLATTR. In addition, you can test for the following special attributes:
'G' | |
'L' | |
'C' |
returns 1 if the list identifier is also a class identifier. |
'O' |
returns 1 if the list identifier is also an object identifier. |
is the position of the item in the list. The position can be specified as a positive or negative number. By default, index is 1 (the first item). If index is omitted, HASATTR checks to see if the specified list has the named attribute. If index is specified, HASATTR checks to see if the specified item has the named attribute. 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.
Details |
If no value is specified for index, HASATTR queries the attribute of the list. If a nonzero value is specified for index, HASATTR queries the attribute of an item in the list.
For a list of attributes for lists and list items, see SETLATTR.
Examples |
Clear the list identified by MYLIST only if it has the UPDATE attribute:
if hasattr(mylist,'UPDATE') then rc=clearlist (mylist);
Determine whether the third item in a list has the FIXEDTYPE attribute:
isfixed=hasattr(mylist,'FIXEDTYPE',3);
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.