FCMP Procedure

Identifying the Location of Compiled Functions and Subroutines: The CMPLIB= System Option

Overview of the CMPLIB= System Option

The SAS system option CMPLIB= specifies where to look for previously compiled functions and subroutines. All procedures (including FCMP) that support the use of FCMP functions and subroutines use this system option.
Instead of specifying the LIBRARY= option on every procedure statement that supports functions and subroutines, you can use the CMPLIB= system option to set libraries that can be used by all procedures.

Syntax of the CMPLIB= System Option

The syntax for the CMPLIB= option has the following form:
OPTIONS CMPLIB = library
OPTIONS CMPLIB = (library–1, ..., library-n)
OPTIONS CMPLIB = list-1, ..., list-n
where
OPTIONS
identifies the statement as an OPTIONS statement.
library
specifies that the previously compiled libraries be linked into the program.
list
specifies a list of libraries.

Example 1: Setting the CMPLIB= System Option

The following example shows how to set the CMPLIB= system option.
  • OPTIONS cmplib = sasuser.funcs;
  • OPTIONS cmplib = (sasuser.funcs work.functions mycat.funcs);
  • OPTIONS cmplib =( sasuser.func1 - sasuser.func10);

Example 2: Compiling and Using Functions

In the following example, PROC FCMP compiles the SIMPLE function and stores it in the sasuser.models data set. Then the CMPLIB= system option is set, and the function is called by PROC MODEL.
The output from this example spans several pages.
proc fcmp outlib = sasuser.models.yval;
   function simple(a,b,x);
      y=a+b*x;
      return(y);
   endsub;
run;

options cmplib = sasuser.models nodate ls=80;

data a;
   input y @@;
   x=_n_;
   datalines;
08 06 08 10 08 10
;

proc model data=a;
   y=simple(a,b,x);
   fit y / outest=est1 out=out1;
quit;
Compiling and Using Functions: Output 1
Compiling and Using Functions: Output 1
Compiling and Using Functions: Output 2
Compiling and Using Functions: Output 2
Compiling and Using Functions: Output 3
Compiling and Using Functions: Output 3
Compiling and Using Functions: Output 4
Compiling and Using Functions: Output 4
Compiling and Using Functions: Output 5
Compiling and Using Functions: Output 5
For information about PROC MODEL, see the SAS/ETS User's Guide.