Previous Page | Next Page

SAS Component Language Dictionary

GETLATTR



Returns the attributes of either an SCL list or an item in the list
Category: List

Syntax
Details
Example
See Also

Syntax

attributes=GETLATTR(list-id<,index>);

attributes

contains a string of words separated by blanks. Each word is a separate attribute for a list or item.

Type: Character

list-id

contains the identifier of the list that GETLATTR processes. An invalid list-id produces an error condition.

Type: Numeric or List

index

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 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.

If index is 0 or is omitted, then the attributes returned by GETLATTR are list attributes. If index is nonzero, then GETLATTR returns the attributes associated with the indexed item instead of the attributes for the entire list.

Type: Numeric


Details

The items in attributes can be used to assign attributes to another list or item. The string returned as attributes contains a blank before and after each attribute, which makes it easy to determine whether an attribute is set by searching attributes for an attribute name. Use the INDEX function to search the string for a specified attribute.

If index is omitted, attributes contains one attribute from each row of the following table:

Default Setting Alternate Setting
UPDATE NOUPDATE
NOFIXEDTYPE FIXEDTYPE
NOFIXEDLENGTH FIXEDLENGTH
ANYNAMES SASNAMES
DUPNAMES NODUPNAMES
NOCHARONLY CHARONLY
NONUMONLY NUMONLY
COPY NOCOPY
HONORCASE NOHONORCASE

If index is supplied, then attributes is the set of item attributes consisting of one attribute from each row of the following table:

Default Setting Alternate Setting
ACTIVE INACTIVE
DELETE NODELETE
NOFIXEDTYPE FIXEDTYPE
UPDATE NOUPDATE
WRITE NOWRITE

For detailed information about these attributes, see SETLATTR.


Example

Create a list LISTID with one item and print the sets of list attributes for LISTID as well as the item attributes that are associated with the first item of LISTID. Note the leading and trailing blanks in the attribute strings, which are made evident by embedding the attribute strings in double quotation marks.

INIT:
   listid = makelist(1);
   listattrs = '"' || getlattr(listid) || '"';
   put listattrs=;
   found = index(listattrs,'UPDATE');
   put found=;
   itemattrs = '"' || getlattr(listid,1) || '"';
   put itemattrs=;
   rc = dellist(listid);
return;

The output of this example is

LISTATTRS=" DELETE UPDATE NOFIXEDTYPE
NOFIXEDLENGTH ANYNAMES DUPNAMES
NOCHARONLY NONUMONLY COPY NOHONORCASE"
FOUND=10;
ITEMATTRS=" ACTIVE WRITE NOAUTO NOEDIT
DELETE UPDATE NOFIXEDTYPE "

FOUND returns the starting position of the word "UPDATE" in the string of list attributes.


See Also

HASATTR

SETLATTR

Previous Page | Next Page | Top of Page