Create Macro
The MaxL create macro statement helps you create and register your own Essbase calculation macro, as your chosen combination of existing calculation functions or macros. This statement registers the new macro with the Essbase custom-defined function and macro catalog.
Minimum permission required is Application Manager to create a local (application-level) macro, or system administrator to create a global (system-level) macro.
Syntax

Description of the illustration cremacro.gif
Use the MaxL create macro statement to create a macro in the following ways:
Keywords
- create macro MACRO-NAME as MACRO-EXPANSION
-
Create and register a custom-defined macro as your chosen combination of existing calculation functions or macros. Register the macro either as a global macro usable by the entire Essbase Server, or as a local macro available to an application. To register a global (server-wide) macro, use one token for MACRO-NAME. To register a local (application-wide) function, use two tokens.
- create macro MACRO-NAME <macro-signature>...
-
Enter for the macro an optional signature defining the syntax rules for macro arguments. A macro signature describes the style in which arguments (or input parameters) to the macro may be passed. One example of a macro signature is (SINGLE, SINGLE, GROUP), meaning that the macro must be passed two comma-separated arguments followed by a list of arguments. See Custom-Defined Macro Input Parameters.
- create or replace macro MACRO-NAME ...
-
Register a global or local custom-defined macro. If a macro with that name already exists in the custom-defined function and macro catalog, it is replaced.
- create macro MACRO-NAME as MACRO-EXPANSION spec CALC-SPEC-STRING
-
The optional spec clause is a calculator-syntax specification string, as in the following example:
@MYMACRO (mbrName, rangeList)
. Use a specification string if you wish the macro to be returned by the output string of the IEssCube.getCalcFunctions Java method or EssListCalcFunctions C API function.Note:
If you do not specify a calculation specification string, you cannot specify a comment either.
- create macro MACRO-NAME as MACRO-EXPANSION spec CALC-SPEC-STRING comment COMMENT-STRING
-
The optional comment clause enables you to add a description of the macro (optional). You cannot create a comment without also using spec clause to create a calculator-syntax specification string. The optional calculator-syntax specification string and the comment are used as the output string of the IEssCube.getCalcFunctions Java method or EssListCalcFunctions C API function.
Notes
-
To create a global (system-level) macro, use a single name for MACRO-NAME. For example, '@COVARIANCE'.
-
To create a local (application-level) macro, use MaxL's double naming convention for MACRO-NAME. For example, Sample.'@COVARIANCE'.
Example
create macro Sample.'@COVARIANCE'(single, single) as '@COUNT(SKIPMISSING,@RANGE(@@S))' spec '@COVARIANCE (expList1, expList2)' comment 'Computes covariance of two sequences given as expression lists';