Previous Page | Next Page

SAS Component Language Dictionary

DIRLIST



Opens a host selection list window that lists members of one or more SAS data libraries, and returns a user's selections
Category: Selection List

Syntax
Name Specifications for Arguments
Details
Example
See Also

Syntax

selections=DIRLIST(lib-spec,member-type,num-sel,prefix<,table-type<,sel-excl<,message>>>);

selections

contains one or more user selections. Multiple selections are separated by blanks. By default, selections is 200 bytes long. To accommodate values longer than 200 bytes, explicitly declare selections with a longer length.

Type: Character

lib-spec

lists one or more librefs that are associated with particular SAS data libraries. To include or exclude SAS data libraries, use a name specification style from Name Specifications for Arguments. By default, SASHELP is not included in the selection window.

Type: Character

member-type

lists one or more types of SAS data library members. For example, a few common member-types are DATA, VIEW, and CATALOG. To include or exclude particular member-types, use a name specification style from Name Specifications for Arguments.

Type: Character

num-sel

is the maximum number of items that a user can select from the list. To display the list for information purposes only (no selections allowed), specify 0. To specify an unlimited number of selections, use a value such as 9999 that is larger than the number of available selections.

Type: Numeric

prefix

specifies whether names that are selected are prefixed with the libref:

'Y'

Selected names are returned as libref.name.

'N' or "

Selected names are returned as name.

table-type

lists one or more SAS table types. By default, the selection list displays members of all SAS table types. To include or exclude specific table types, use a name specification style from Name Specifications for Arguments. This argument is ignored unless DATA is one of the values of member-type. For information about table types, see the description of the TYPE= data set option in SAS Language Reference: Dictionary.

Type: Character

sel-excl

lists one or more SAS data library members to include or exclude from the list. Use a name specification style from Name Specifications for Arguments. If prefix is N, then specify the name here as member. If prefix is Y, then specify the name here as libref.member.

Type: Character

message

is the text for a message to be displayed above the selection list. The default message tells users to make up to the number of selections specified in num-sel.

Type: Character

autoclose

is an obsolete argument but is retained for compatibility with earlier releases. If you want to specify a value for num-sel, then specify " as a placeholder for this argument.


Name Specifications for Arguments

For lib-spec, member-type, and table-type, use these guidelines for specifying names:


Details

If a user closes the selection list window without making a selection, selections contains a blank value unless that variable contained a valid value before DIRLIST was called.

The values for all selections can be returned in the current result list, if one is available. The current result list is a special SCL list that is automatically filled with the values selected from a selection list. To use a current result list, use the MAKELIST function to create the list, and use the CURLIST function to designate it as the current result list. The current result list must exist before you call the DIRLIST function.

When the function is invoked, the current result list is cleared. After DIRLIST is invoked, the current result list contains the following named elements:

TAG

identifies the list as one that was created by DIRLIST.

Type: Character

COUNT

contains the number of selected items or contains 0 if a user makes no selections or issues a CANCEL command in the list window.

Type: Numeric

NAME

contains the uppercase name of each selected catalog entry. If prefix is Y, then the name is in the form libref.member. Otherwise, it is in the form member. There is one NAME element for each selection made.

Type: Character

DESC

contains the description of each selected catalog entry. There is one DESC element for each selection made. The value of DESC is in the case entered originally. If the SAS system option DETAILS is in effect, then DESC contains the table label.

Type: Character

TYPE

contains the type of each selected library member. There is one TYPE element for each selection.

Type: Character

Because some engines support mixed-case filenames, DIRLIST now retains the cases of the returned selected items. This may cause your application to fail if your application contains code that assumes the returned selection is uppercased. For example,

if (dirlist(dsid, 'TESTNDX')='NDXVAR')

must be changed to

if (upcase(dirlist(dsid, 'TESTNDX'))='NDXVAR'

If the application cannot be modified, you may need to specify the VALIDVARNAME=V6 system option when you run the application to ensure that the selections returned from the DIRLIST function will be uppercased.


Example

Display a selection list of SAS tables in the SAS libraries MYLIB1 and MYLIB2 except MYLIB1.ANSWERS, and enable users to select up to three table names. The selections are retrieved from the current environment list by using GETNITEMC.

listid=makelist();
rc=curlist(listid);
selections=dirlist('mylib1 mylib2','data',3,'Y',
                     ' ','^ mylib1.answers');
n=getnitemn(listid,'COUNT');
do i=1 to n;
   member=getnitemc(listid,'NAME',i);
   descript=getnitemc(listid,'DESC',i);
   memtype=getnitemc(listid,'TYPE',i);
   put member= descript= memtype=;
end;


See Also

CATLIST

FILELIST

LIBLIST

Previous Page | Next Page | Top of Page