FCMP Procedure

PROC FCMP Statement

Creates, tests, and stores SAS functions, CALL routines, and subroutines
Creating a Function and Calling the Function from a DATA Step

Creating a CALL Routine and a Function

Using GTL with User-Defined Functions

Standardizing Each Row of a Data Set

Syntax

PROC FCMP options;

Optional Arguments

ENCRYPT
HIDE
specifies to encode the source code in a data set.
FLOW
specifies printing a message for each statement in a program as it is executed. This option produces extensive output.
LIBRARY | INLIB=library.dataset
LIBRARY | INLIB=(library-1.dataset library-2.dataset ... library-n.dataset)
LIBRARY | INLIB=library.datasetM - library.datasetN
specifies that previously compiled libraries are to be linked into the program. These libraries are created by a previous PROC FCMP step or by using PROC PROTO (for external C routines).
Tips:Libraries are created by the OUTLIB= option and are stored as members of a SAS library that have the type CMPSUB. Only subroutines and functions are read into the program when you use the LIBRARY= option.

If the routines that are being declared do not call PROC FCMP routines in other packages, then you do not need to specify the INLIB= option. Use the libref.dataset format to specify the two-level name of a library. The libref and dataset names must be valid SAS names that are not longer than eight characters. You can specify a list of files with the LIBRARY= option, and you can specify a range of names by using numeric suffixes. When you specify more than one file, you must enclose the list in parentheses, except in the case of a single range of names. The following are syntax examples:

proc fcmp library=sasuser.exsubs;
proc fcmp library=(sasuser.exsubs work.examples);
proc fcmp library=lib1-lib10;

LIST
specifies that both the LISTSOURCE and the LISTPROG options are in effect.
Tip:Printing both the source code and the compiled code and then comparing the two listings of assignment statements is one way of verifying that the assignments were compiled correctly.
LISTALL
specifies that the LISTCODE, LISTPROG, and LISTSOURCE options are in effect.
LISTCODE
specifies that the compiled program code be printed. LISTCODE lists the chain of operations that are generated by the compiler.
Tip:Because LISTCODE output is somewhat difficult to read, use the LISTPROG option to obtain a more readable listing of the compiled program code.
LISTFUNCS
specifies that prototypes for all visible FCMP functions or subroutines be written to the SAS listing.
LISTPROG
specifies that the compiled program be printed. The listing for assignment statements is generated from the chain of operations that are generated by the compiler. The source statement text is printed for other statements.
Tip:The expressions that are printed by the LISTPROG option do not necessarily represent the way that the expression is actually calculated, because intermediate results for common subexpressions can be re-used. However, the expressions are printed in expanded form by the LISTPROG option. To see how the expression is actually evaluated, refer to the listing from the LISTCODE option.
LISTSOURCE
specifies that source code statements for the program be printed.
OUTLIB=libname.dataset.package
specifies the three-level name of an output data set to which the compiled subroutines and functions are written when the PROC FCMP step ends. This argument is required. The following are syntax examples:
proc fcmp outlib=sasuser.fcmpsubs.pkt1;
proc fcmp outlib=sasuser.mysubs.math;
Tips:Use this option when you want to save subroutines and functions in an output library.

Only those subroutines that are declared inside the current PROC FCMP step are saved to the output file. Those subroutines that are loaded by using the LIBRARY= option are not saved to the output file. If you do not specify the OUTLIB= option, then no subroutines that are declared in the current PROC FCMP step are saved.

PRINT
specifies printing the result of each statement in a program as it is executed. This option produces extensive output.
TRACE
specifies printing the results of each operation in each statement in a program as it is executed. These results are produced in addition to the information that is printed by the FLOW option. The TRACE option produces extensive output.
Tip:Specifying TRACE is equivalent to specifying FLOW, PRINT, and PRINTALL.