Chapter Contents

Previous

Next
OPENSASFILEDIALOG

OPENSASFILEDIALOG



Displays a dialog window that lists SAS files, and returns the user's selection

Category: Selection List


Syntax
Details
Examples
Example 1: Opening a SAS File
Example 2: Returning a Two-Level Name
Example 3: Using the Advanced Button with an SCL List
See Also

Syntax

selection=OPENSASFILEDIALOG(<type<,level-count<,entry-name<,list-id>>>>);

selection
contains the two- or three-level name of the selected SAS file, or a blank if nothing is selected.

Type: Character

type
specifies one or more member types to list in the dialog window, such as DATA, VIEW, MDDB, and CATALOG. This can reduce the length of the list in the dialog window. If type is not used, the names of all SAS files in the data library are listed. Multiple types should be separated by blanks.

Type: Character

level-count
specifies whether the function returns a two- or three-level name. The only valid choices are 2 and 3. The default is 2.

Type: Numeric

entry-name
is a two- or four-level name of a catalog entry to call when a user selects the [Advanced] button in the dialog window. The entry can be any of the following types: FRAME, SCL, PROGRAM, HELP, CBT, or MENU.

If entry-name is not specified, then the window does not contain [Advanced].

Type: Character

list-id
contains the identifier of an SCL list that is passed to entry-name.

Type: Numeric or List


Details

OPENSASFILEDIALOG displays a list of SAS files from which a user can make a selection. You can pass that selection to code that opens the SAS file.

If entry-name is supplied and [Advanced] is selected, the item selected in the dialog window is passed to entry-name through the following variables, which are created automatically:

USERDATA
contains the list that is passed in the call to OPENSASFILEDIALOG.

LIBREF
contains the libref of the selected item.

MEMBER
contains the member name of the selected item.

TYPE
contains the member type of the selected item.

List-id enables information to be passed between the calling entry and entry-name. It is passed to entry-name through the USERDATA variable.


Examples

Example 1: Opening a SAS File

Select a SAS file of type DATA to open and display the table.

selection=opensasfiledialog('data');
call fsview(selection);

Example 2: Returning a Two-Level Name

Open a SAS file of type DATA that returns a two-level name.

selection=opensasfiledialog('data view',2'work.a.a.scl',listid);

Example 3: Using the Advanced Button with an SCL List

Specify an entry to be called when a user selects [Advanced] as well as an SCL list that contains values to pass to the entry. The entry can be any of the following types: FRAME, SCL, PROGRAM, HELP, CBT, or MENU. If entry-name is not specified, then the window does not contain [Advanced].

dcl list mydata;
mydata=makelist();
rc=insertc(mydata,'test');
selection = opensasfiledialog('data',
   'mylib.mycat.myentry.frame',mydata);
if sysrc(1)=-1 then do;
   ...SCL statements to execute when
   the user cancels from the window...
end;
else do;
   ...SCL statements to handle selections...
end;

The SCL entry for MYLIB.MYCAT.MYENTRY.FRAME contains the following program:

dcl char(8) libref type;
dcl char(32) member;
dcl list userdata;
init:
put libref=;
put member=;
put type=;
call putlist(userdata);
return;

Note:   The SCL entry must declare these exact variables, in the order specified, to properly reference the selected entry.  [cautionend]
If the user selects MYLIB2.MYMEMBER2.DATA in the dialog window and then selects [Advanced], the output for this program is

libref=Mylib2
member=Mymember2
type=Data
('test')[1]

See Also

SAVESASFILEDIALOG


Chapter Contents

Previous

Next

Top of Page

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