Working with Existing Functions

Open a Function

To open a function, select a library from the left pane, expand the library, and drill down until a list of functions appears. Double-click the name of the function that you want to open.
If you open a function from a read-only library, a window similar to the following appears:
A Function in a Library That Has Read-Only Access
A Function in a Library That Has Read-Only Access
In the window above, the AMORLINC_SLK function is selected from the read-only SASHELP library. Use the scroll bar to scroll to the top of the function.
If you open a function from a library to which you have write access, a window similar to the following appears:
A Function in a Library That Has Write Access
A Function in a Library That Has Write Access
In the window above, SUBTRACT_MACRO is selected from the write-enabled SASUSER library.
You can see that there is a difference in the windows that appear depending on whether the library has read-only access or write access. If the library has write access, you can enter information in the top section of the window that you are viewing. These fields are the same fields that you use when you create a new function. For a description of the fields, see Creating a New Function.

Opening Multiple Functions

Opening multiple functions results in multiple windows being opened. For example, if you open a second function, a second window appears that shows the code for that function.
The upper right corner of the FCmp Function Editor contains a field called Open Views. Click the arrow to list the functions that are open. When you select a function, the window for that function is brought to the foreground.
Two icons that you can use to alter the display of your functions are located to the left of the Open Views field:
icon
cascades the display of the functions that are open.
icon
arranges the functions to display side by side.

Move a Function

You can move a function to a different library, data set, or package. To move a function, select a function in the left pane. Right-click the function, and select Move from the menu. The following dialog box appears:
The Move Function Dialog Box
The Move Function Dialog Box
In the Move Function dialog box, you can perform the following tasks:
  • enter a new name for the function
  • select a library into which the function is to be moved
  • enter a new data set name
  • enter a package name
The descriptions of the fields in the Move Function dialog box are listed below:
Name
specifies the new name for the function.
Library
specifies the library that will contain the function that you move. Use the menu in the Library field to select a library.
Data Set
specifies the data set that will contain the function that you move. Enter the name of the data set, or click the down arrow in the Data Set field to select a data set. If you do not choose a data set, then the value in this field defaults to Functions.
Package
specifies the name of the package that will contain the new function that you move. Enter the name of the package, or click the down arrow in the Package field to select a package. If you do not choose a package, then the value in this field defaults to PACKAGE.
When you click OK, the following dialog box appears, cautioning you about the move:
The Move Function Confirmation Dialog Box
The Move Function Confirmation Dialog Box
CAUTION:
Other functions and macros that reference the function that you want to move will not be updated with the new function location. This situation can cause referencing objects such as macros to be out of synchronization.
Click Yes or No.

Close a Function

When you right-click the function name in the left pane and select Close, the window that displays that function closes. You can also close the function by clicking OK in the bottom right corner of the window that displays the function.

Duplicate a Function

You can duplicate (copy) a function that you are viewing to an existing or new package or library to which you have write access. To duplicate a function, select the function in the left pane. Right-click the function and select Duplicate from the menu. The following dialog box appears:
The Duplicate Function Dialog Box
The Duplicate Function Dialog Box
The fields in this dialog box automatically display the function name, library, data set, and package of the function that you want to duplicate. You can change these fields when you duplicate the function.
For a description of these fields, see Move a Function.

Rename a Function

Use the Rename dialog box to rename a function within a given package. You must have write access to the library that contains the function. When you rename a function, the new function resides in the same library as the original function.
To rename a function, select the function in the left pane. Right-click the function and select Rename from the menu. Enter the new name of the function and click OK.
CAUTION:
Rename enables you to rename a function within a given package. Just as with moving a function, the renaming of a function does not modify dependent macros and other entities.

Delete a Function

You can delete a function from a library to which you have write access. To delete a function, select the function that you want to delete. Right-click the function and select Delete from the menu. The following dialog box appears, cautioning you about the impact that Delete has on other items:
Delete Function Confirmation Dialog Box
Delete Function Confirmation Dialog Box
Click Yes or No.