The SAS System provides users with the ability to create, store and access custom functions using the Function Compiler (FCMP) procedure. Once defined with PROC FCMP, a user-defined function can be used, or called, just like any other SAS function in the SAS System. This powerful capability gives users the ability to process and maintain code as independent and reusable subroutines. PROC FCMP functions are stored in a data set and can be used in a DATA step, a WHERE statement, with Output Delivery System (ODS), and numerous procedures including PROC CALIS, PROC COMPUTAB, PROC GENMOD, PROC MODEL, PROC NLIN, PROC NLMIXED, PROC NLP, PROC PHREG, PROC REPORT, PROC SIMILARITY, and PROC SQL. The following example illustrates the syntax used to create and call the custom user-defined function with the FCMP procedure.
To learn more about Kirk Lafler and to read a free chapter from his book PROC SQL: Beyond the Basics Using SAS, visit his author page.