Have you ever wondered, Why SAS never had functions similar to any other programming Language i.e. C, C++, Java…
LINK/ Return statement and SAS Macros to some extent served the purpose in modularizing and developing re-usable code for repeating tasks…but doesn’nt make it is easy to follow….Macros are easier to reuse; however, they are not independent from the main program, they involve non-DATA step syntax, and substantial use of macros can result in illegible code.
SAS finally broke this jinx with FCMP procedure in version 9.1 and above.
In SAS®9.1, the FCMP procedure provides the ability to write functions to be used in conjunction with few SAS Procedures….
Starting with SAS® 9.2, these user-written functions can be called from a DATA step as well.PROC FCMP provides the ability to write true functions and CALL routines in DATA step syntax that are stored in a data set. In SAS 9.2, FCMP routines can be called from the DATA step like any other SAS function. This enables programmers to more easily read, write, and maintain complex code with independent and reusable subroutines.