Previous Page | Next Page

SAS Component Language Dictionary

SAVESASFILEDIALOG



Displays a dialog window that lists SAS files, and returns the name of the selected file
Category: Selection List

Syntax
Details
Examples
Example 1: Saving a SAS File
Example 2: Using the Advanced Button with an SCL List
Example 3: Using the LEVEL Parameter
See Also

Syntax

selection=SAVESASFILEDIALOG(<type<,level-count<,initial<,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 a member type 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.

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

Type: Numeric

initial

is the name of the SAS file to be the initially selected item in the dialog window when it opens.

entry-name

is a two- or four-level name of a catalog entry that is called 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.

list-id

contains the identifier for an SCL list that you can pass when entry-name is specified. The items in this list are the items to be displayed in the application's Advanced window for selection by application users.


Details

SAVESASFILEDIALOG enables you to implement a Save As choice by displaying a dialog window that lists SAS files. SAVESASFILEDIALOG returns a user's selection, which enables you to create code that performs the save action. The SAS file can be saved under a different name or the same name.

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:

USERDATA

contains the list that is passed in the call to SAVESASFILEDIALOG.

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: Saving a SAS File

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

selection=savesasfieldialog('data view',3,'work.one');


Example 2: Using the Advanced Button with an SCL List

Specify an entry of type DATA to be called when a user selects the Advanced button, 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 = savesasfiledialog('data', 2','mylib.mycat.initial.frame',
   'mylib.mycat.myentry.frame',mydata);
if (sysrc(1)=-1) then do;
   ...SCL statements to handle when the user 
   cancels from 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;
dcl char(32) member;
dcl char(8) type;
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]


Example 3: Using the LEVEL Parameter

Select a SAS file to save and return different levels.

selection=savesasfiledialog ('data",2);
put selection=
selection=savesasfiledialog('data',3);
put selection=

If the user selects MYLIB.MYMEMBER.DATA for both selections, the output would be

selection=mylib.mymember
selection=mylib.mymember.data


See Also

OPENSASFILEDIALOG

Previous Page | Next Page | Top of Page