SAS Component Language Dictionary |
Category: | Selection List |
Syntax | |
Details | |
Examples | |
Example 1: Displaying the Printer Devices of a Catalog | |
Example 2: Using the Results of a DEVLIST | |
See Also |
Syntax |
selections=DEVLIST(catalog-name,device<,message
<,autoclose<,num-sel>>>); |
are one or more user selections from the list, or blank if the selection list window is closed and no selections are made.
is the catalog that lists the devices. Usually the catalog SASHELP.DEVICES is used as catalog-name.
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.
specifies whether the selection list window closes automatically after a user makes a selection when only one choice is allowed:
'Y' | |
'N' |
This option is ignored when num-sel is not 1. However, use '' as a placeholder if you are also specifying a value for num-sel.
specifies the maximum number of items 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 that is larger than the number of available selections about graphic device drivers such as 9999.
Details |
The value in selections consists of a 40-character description, an 8-character device name, and an 8-character device type. For additional details about graphic device drivers, see SAS/GRAPH: Reference and the SAS online Help for SAS/GRAPH software.
You can provide a default value or an initial selected value in the list by providing a value for the selections variable before calling DEVLIST. If selections contains valid entry names when the function is invoked, those names are automatically designated as selected when the selection list is displayed.
If a user closes the selection list window without making a selection, then DEVLIST returns a blank value unless there was an initial value for the selections variable before DEVLIST was called.
When multiple selections are allowed, selections contains the first value selected from the list. However, 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 DEVLIST.
When DEVLIST is invoked, the current result list is cleared. After DEVLIST is invoked, the result list contains the following named items:
identifies the list as one that was created by the DEVLIST function.
contains either the number of selected elements, or 0 if a user makes no selections or issues a CANCEL command in the list window.
contains the description of the selected device. There is one DESC element for each selection. The value of DESC is in the case that was entered originally.
contains the name for each selected device. There is one DEVICE element for each selection.
contains the type of each selected device. There is one TYPE element for each selection.
Examples |
Display a list of devices of type PRINTER that are available in the catalog SASHELP.DEVICES. After the user selects one device from the list, the program uses the SUBSTRING function to extract the individual items of information returned by DEVLIST.
select=devlist('sashelp.devices','printer', 'Select a device.'); descript=substr(select,1,40); device=substr(select,41,8); devtype=substr(select,49,8);
Use the current result list to process multiple selections:
listid=makelist(); rc=curlist(listid); selection=devlist('sashelp.devices','printer', 'Select a device',' ',3); n=getnitemn(listid,'COUNT'); do i=1 to n; descript=getnitemc(listid,'DESC',i); device=getnitemc(listid,'DEVICE',i); devtype=getnitemc(listid,'TYPE',i); put descript= device= devtype=; end;
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.