register.mxl Sample Code

/* <maxl version="11.1.1" encoding="UTF-8"/> */ 

/** 
 * This script registers methods of the class Statistics as custom-defined functions
 * for a specified application
 * Usage: Log in to MaxL Shell, then call: msh register.mxl appname
 */


//** 
 * Register function average 
 */
CREATE MACRO $1.'@JAVG'(GROUP)
AS '@_JAVG(@@S)'
SPEC '@JAVG(expList)'
COMMENT 'Computes the average of non-missing values in a data set (expList)';

CREATE FUNCTION $1.'@_JAVG' 
AS 'com.hyperion.essbase.calculator.Statistics.avg(double [])';


/**
 * Register function weighted average
 */
CREATE FUNCTION $1.'@JAVGW'
AS 'com.hyperion.essbase.calculator.Statistics.avg(double [],double [])' 
SPEC '@JAVGW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted average of non-missing values in a data set (expList)';


/** 
 * Register functions average and weighted average with a skip instruction. 
 * These functions will be used through macros, so no spec/comment specified.
 * Since these functions will not be used directly, the names start with '@_'.
 */
CREATE FUNCTION $1.'@_JAVGS' 
AS 'com.hyperion.essbase.calculator.Statistics.avg(int,double [])';
CREATE FUNCTION $1.'@_JAVGWS' 
AS 'com.hyperion.essbase.calculator.Statistics.avg(int,double [],double [])';


/**
 * Register macro for average with a skip instruction
 */
CREATE MACRO $1.'@JAVGS'(SINGLE,GROUP) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JAVGS (0, @@2) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JAVGS (1, @@2) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JAVGS (2, @@2) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JAVGS (3, @@2) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JAVGS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList)'
COMMENT 'Computes the average value of a data set (expList) with skip instructions';


/**
 * Register macro for weighted average with a skip instruction
 */
CREATE MACRO $1.'@JAVGWS'(SINGLE,SINGLE,SINGLE) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JAVGWS (0, @@2, @@3) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JAVGWS (1, @@2, @@3) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JAVGWS (2, @@2, @@3) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JAVGS (3, @@2, @@3) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JAVGWS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, @LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted average value of a data set (expList) with skip instructions';


/** 
 * Register function correlation 
 */
CREATE FUNCTION $1.'@JCORR' 
AS 'com.hyperion.essbase.calculator.Statistics.correlation(double [],double [])' 
SPEC '@JCORR(@LIST(expList1), @LIST(expList2))'
COMMENT 'Computes the correlation coefficient between two data sets (expList1 and expList2)';


/**
 * Register function weighted correlation
 */
CREATE FUNCTION $1.'@JCORRW' 
AS 'com.hyperion.essbase.calculator.Statistics.correlation(double [],double [],double [])' 
SPEC '@JCORRW(@LIST(expList1), @LIST(expList2), @LIST(weightExpList))'
COMMENT 'Computes the weighted correlation coefficient between two data sets (expList1 and expList2)';


/** 
 * Register function count 
 */
CREATE MACRO $1.'@JCOUNT'(GROUP)
AS '@_JCOUNT(@@S)'
SPEC '@JCOUNT(expList)'
COMMENT 'Computes the count of non-missing elements in a data set (expList)';

CREATE FUNCTION $1.'@_JCOUNT' 
AS 'com.hyperion.essbase.calculator.Statistics.count(double [])';

/** 
 * Register function count with a skip instruction. 
 * This function will be used through macros, so no spec/comment specified.
 * Since this function will not be used directly, the name starts with '@_'.
 */
CREATE FUNCTION $1.'@_JCOUNTS' 
AS 'com.hyperion.essbase.calculator.Statistics.count(int,double [])';

 
/**
 * Register macro for count with a skip instruction
 */
CREATE MACRO $1.'@JCOUNTS'(SINGLE,GROUP) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JCOUNTS (0, @@2) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JCOUNTS (1, @@2) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JCOUNTS (2, @@2) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JCOUNTS (3, @@2) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JCOUNTS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList)'
COMMENT 'Computes the number of elements of a data set (expList) with skip instructions';


/** 
 * Register function covariance 
 */
CREATE FUNCTION $1.'@JCOVAR' 
AS 'com.hyperion.essbase.calculator.Statistics.covariance(double [],double [])' 
SPEC '@JCOVAR(@LIST(expList1), @LIST(expList2))'
COMMENT 'Computes the covariance between two data sets (expList1 and expList2)';


/**
 * Register function weighted covariance
 */
CREATE FUNCTION $1.'@JCOVARW' 
AS 'com.hyperion.essbase.calculator.Statistics.covariance(double [],double [],double [])' 
SPEC '@JCOVARW(@LIST(expList1), @LIST(expList2), @LIST(weightExpList))'
COMMENT 'Computes the weighted covariance between two data sets (expList1 and expList2)';


/** 
 * Register function geometric mean 
 */
CREATE MACRO $1.'@JGEOMEAN'(GROUP)
AS '@_JGEOMEAN(@@S)'
SPEC '@JGEOMEAN(expList)'
COMMENT 'Computes the geometric mean of a data set (expList)';

CREATE FUNCTION $1.'@_JGEOMEAN' 
AS 'com.hyperion.essbase.calculator.Statistics.geomean(double [])';

/**
 * Register function weighted geometric mean
 */
CREATE FUNCTION $1.'@JGEOMEANW' 
AS 'com.hyperion.essbase.calculator.Statistics.geomean(double [],double [])' 
SPEC '@JGEOMEANW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted geometric mean of a data set (expList)';


/** 
 * Register function harmonic mean 
 */
CREATE MACRO $1.'@JHARMEAN'(GROUP) 
AS '@_JHARMEAN(@@S)' 
SPEC '@JHARMEAN(expList)'
COMMENT 'Computes the harmonic mean of a data set (expList)';

CREATE FUNCTION $1.'@_JHARMEAN' 
AS 'com.hyperion.essbase.calculator.Statistics.harmean(double [])';

/**
 * Register function weighted harmonic mean
 */
CREATE FUNCTION $1.'@JHARMEANW' 
AS 'com.hyperion.essbase.calculator.Statistics.harmean(double [],double [])' 
SPEC '@JHARMEANW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted harmonic mean of a data set (expList)';


/** 
 * Register function kurtosis 
 */
CREATE MACRO $1.'@JKURT'(GROUP)
AS '@_JKURT(@@S)' 
SPEC '@JKURT(expList)'
COMMENT 'Computes the kurtosis of a data set (expList)';

CREATE FUNCTION $1.'@_JKURT' 
AS 'com.hyperion.essbase.calculator.Statistics.kurt(double [])';

/**
 * Register function weighted kurtosis
 */
CREATE FUNCTION $1.'@JKURTW' 
AS 'com.hyperion.essbase.calculator.Statistics.kurt(double [],double [])' 
SPEC '@JKURTW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted kurtosis of a data set (expList)';


/** 
 * Register function max 
 * There is only one function with this name, so no need to specify the signature
 */
CREATE MACRO $1.'@JMAX'(GROUP)
AS '@_JMAX(@@S)' 
SPEC '@JMAX(expList)'
COMMENT 'Computes the maximum of a data set (expList)';

CREATE FUNCTION $1.'@_JMAX' 
AS 'com.hyperion.essbase.calculator.Statistics.max';

/** 
 * Register function median 
 * There is only one function with this name, so no need to specify the signature
 */
CREATE MACRO $1.'@JMEDIAN'(GROUP) 
AS '@_JMEDIAN(@@S)' 
SPEC '@JMEDIAN(expList)'
COMMENT 'Computes the median of a data set (expList)';

CREATE FUNCTION $1.'@_JMEDIAN' 
AS 'com.hyperion.essbase.calculator.Statistics.median';

/** 
 * Register function min 
 * There is only one function with this name, so no need to specify the signature
 */
CREATE MACRO $1.'@JMIN'(GROUP)
AS '@_JMIN(@@S)' 
SPEC '@JMIN(expList)'
COMMENT 'Computes the minimum of a data set (expList)';

CREATE FUNCTION $1.'@_JMIN' 
AS 'com.hyperion.essbase.calculator.Statistics.min';

/** 
 * Register function mode 
 * There is only one function with this name, so no need to specify the signature
 */
CREATE MACRO $1.'@JMODE'(GROUP) 
AS '@_JMODE(@@S)' 
SPEC '@JMODE(expList)'
COMMENT 'Computes the mode of a data set (expList)';

CREATE FUNCTION $1.'@_JMODE' 
AS 'com.hyperion.essbase.calculator.Statistics.mode';

/** 
 * Register function percentile 
 */
CREATE MACRO $1.'@JPTILE'(SINGLE, GROUP) 
AS '@_JPTILE(@@1, @@SH1)' 
SPEC '@JPTILE(percent,expList)'
COMMENT 'Computes the specified (percent) percentile of a data set (expList)';

CREATE FUNCTION $1.'@_JPTILE' 
AS 'com.hyperion.essbase.calculator.Statistics.percentile(double,double [])';

/** 
 * Register function product 
 */
CREATE MACRO $1.'@JPROD'(GROUP)
AS '@_JPROD(@@S)' 
SPEC '@JPROD(expList)'
COMMENT 'Computes the product of non-missing values in a data set (expList)';

CREATE FUNCTION $1.'@_JPROD' 
AS 'com.hyperion.essbase.calculator.Statistics.product(double [])';

/**
 * Register function weighted product
 */
CREATE FUNCTION $1.'@JPRODW' 
AS 'com.hyperion.essbase.calculator.Statistics.product(double [],double [])' 
SPEC '@JPRODW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted product of non-missing values in a data set (expList)';


/** 
 * Register function quartile 
 * There is only one function with this name, so no need to specify the signature
 */
CREATE MACRO $1.'@JQTILE'(SINGLE, GROUP)
AS '@_JQTILE(@@1, @@SH1)' 
SPEC '@JQTILE(quart,expList)'
COMMENT 'Computes the specified (quart) quartile of a data set (expList)';

CREATE FUNCTION $1.'@_JQTILE' 
AS 'com.hyperion.essbase.calculator.Statistics.quartile';

/** 
 * Register function rank 
 * There is only one function with this name, so no need to specify the signature
 */
CREATE MACRO $1.'@JRANK'(SINGLE, GROUP)
AS '@_JRANK(@@1, @@SH1)' 
SPEC '@JRANK(value,expList)'
COMMENT 'Computes the rank of a value in a data set (expList)';

CREATE FUNCTION $1.'@_JRANK' 
AS 'com.hyperion.essbase.calculator.Statistics.rank';


/** 
 * Register function skewness 
 */
CREATE MACRO $1.'@JSKEW'(GROUP)
AS '@_JSKEW(@@S)' 
SPEC '@JSKEW(expList)'
COMMENT 'Computes the skewness of a data set (expList)';

CREATE FUNCTION $1.'@JSKEW' 
AS 'com.hyperion.essbase.calculator.Statistics.skew(double [])';


/**
 * Register function weighted skewness
 */
CREATE FUNCTION $1.'@JSKEWW' 
AS 'com.hyperion.essbase.calculator.Statistics.skew(double [],double [])' 
SPEC '@JSKEWW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted skewness of a data set (expList)';


/** 
 * Register function stdev 
 */
CREATE FUNCTION $1.'@JSTDEV'(GROUP) 
AS '@_JSTDEV(@@S)' 
SPEC '@JSTDEV(expList)'
COMMENT 'Computes the standard deviation of non-missing values in a data set (expList)';

CREATE FUNCTION $1.'@_JSTDEV' 
AS 'com.hyperion.essbase.calculator.Statistics.stdev(double [])';


/**
 * Register function weighted stdev
 */
CREATE FUNCTION $1.'@JSTDEVW' 
AS 'com.hyperion.essbase.calculator.Statistics.stdev(double [],double [])' 
SPEC '@JSTDEVW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted standard deviation of non-missing values in a data set (expList)';


/** 
 * Register functions stdev and weighted stdev with a skip instruction. 
 * These functions will be used through macros, so no spec/comment specified.
 * Since these functions will not be used directly, the names start with '@_'.
 */
CREATE FUNCTION $1.'@_JSTDEVS' 
AS 'com.hyperion.essbase.calculator.Statistics.stdev(int,double [])';
CREATE FUNCTION $1.'@_JSTDEVWS' 
AS 'com.hyperion.essbase.calculator.Statistics.stdev(int,double [],double [])';


/**
 * Register macro for stdev with a skip instruction
 */
CREATE MACRO $1.'@JSTDEVS'(SINGLE,GROUP) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JSTDEVS (0, @@2) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JSTDEVS (1, @@2) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JSTDEVS (2, @@2) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JSTDEVS (3, @@2) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JSTDEVS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList)'
COMMENT 'Computes the standard deviation value of a data set (expList) with skip instructions';


/**
 * Register macro for weighted standard deviation with a skip instruction
 */
CREATE MACRO $1.'@JSTDEVWS'(SINGLE,SINGLE,SINGLE) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JSTDEVWS (0, @@2, @@3) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JSTDEVWS (1, @@2, @@3) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JSTDEVWS (2, @@2, @@3) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JSTDEVS (3, @@2, @@3) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JSTDEVWS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList, weightExpList)'
COMMENT 'Computes the weighted standard deviation value of a data set (expList) with skip instructions';


/** 
 * Register function stdevp 
 */
CREATE MACRO $1.'@JSTDEVP'(GROUP)
AS '@_JSTDEVP(@@S)' 
SPEC '@JSTDEVP(expList)'
COMMENT 'Computes the standard deviation(p) of non-missing values in a data set (expList)';

CREATE FUNCTION $1.'@JSTDEVP' 
AS 'com.hyperion.essbase.calculator.Statistics.stdevp(double [])';


/**
 * Register function weighted stdevp
 */
CREATE FUNCTION $1.'@JSTDEVPW' 
AS 'com.hyperion.essbase.calculator.Statistics.stdevp(double [],double [])' 
SPEC '@JSTDEVPW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted standard deviation(p) of non-missing values in a data set (expList)';


/** 
 * Register functions stdevp and weighted stdevp with a skip instruction. 
 * These functions will be used through macros, so no spec/comment specified.
 * Since these functions will not be used directly, the names start with '@_'.
 */
CREATE FUNCTION $1.'@_JSTDEVPS' 
AS 'com.hyperion.essbase.calculator.Statistics.stdevp(int,double [])';
CREATE FUNCTION $1.'@_JSTDEVPWS' 
AS 'com.hyperion.essbase.calculator.Statistics.stdevp(int,double [],double [])';


/**
 * Register macro for stdevp with a skip instruction
 */
CREATE MACRO $1.'@JSTDEVPS'(SINGLE,GROUP) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JSTDEVPS (0, @@2) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JSTDEVPS (1, @@2) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JSTDEVPS (2, @@2) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JSTDEVPS (3, @@2) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JSTDEVPS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList)'
COMMENT 'Computes the standard deviation(p) value of a data set (expList) with skip instructions';


/**
 * Register macro for weighted stdevp with a skip instruction
 */
CREATE MACRO $1.'@JSTDEVPWS'(SINGLE,SINGLE,SINGLE) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JSTDEVPWS (0, @@2, @@3) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JSTDEVPWS (1, @@2, @@3) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JSTDEVPWS (2, @@2, @@3) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JSTDEVPS (3, @@2, @@3) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JSTDEVPWS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList, weightExpList)'
COMMENT 'Computes the weighted standard deviation(p) value of a data set (expList) with skip instructions';


/** 
 * Register function sum 
 */
CREATE MACRO $1.'@JSUM'(GROUP)
AS '@_JSUM(@@S)' 
SPEC '@JSUM(expList)'
COMMENT 'Computes the sum of a data set (expList)';

CREATE FUNCTION $1.'@_JSUM' 
AS 'com.hyperion.essbase.calculator.Statistics.sum(double [])';


/**
 * Register function weighted SUM
 */
CREATE FUNCTION $1.'@JSUMW' 
AS 'com.hyperion.essbase.calculator.Statistics.sum(double [],double [])' 
SPEC '@JSUMW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted sum of a data set (expList)';


/** 
 * Register function var 
 */
CREATE MACRO $1.'@JVAR'(GROUP)
AS '@_JVAR(@@S)' 
SPEC '@JVAR(expList)'
COMMENT 'Computes the variance of non-missing values in a data set (expList)';

CREATE FUNCTION $1.'@_JVAR' 
AS 'com.hyperion.essbase.calculator.Statistics.var(double [])';

/**
 * Register function weighted var
 */
CREATE FUNCTION $1.'@JVARW' 
AS 'com.hyperion.essbase.calculator.Statistics.var(double [],double [])' 
SPEC '@JVARW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted variance of non-missing values in a data set (expList)';


/** 
 * Register functions var and weighted var with a skip instruction. 
 * These functions will be used through macros, so no spec/comment specified.
 * Since these functions will not be used directly, the names start with '@_'.
 */
CREATE FUNCTION $1.'@_JVARS' 
AS 'com.hyperion.essbase.calculator.Statistics.var(int,double [])';
CREATE FUNCTION $1.'@_JVARWS' 
AS 'com.hyperion.essbase.calculator.Statistics.var(int,double [],double [])';


/**
 * Register macro for var with a skip instruction
 */
CREATE MACRO $1.'@JVARS'(SINGLE,GROUP) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JVARS (0, @@2) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JVARS (1, @@2) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JVARS (2, @@2) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JVARS (3, @@2) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JVARS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList)'
COMMENT 'Computes the variance value of a data set (expList) with skip instructions';


/**
 * Register macro for weighted variance with a skip instruction
 */
CREATE MACRO $1.'@JVARWS'(SINGLE,SINGLE,SINGLE) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JVARWS (0, @@2, @@3) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JVARWS (1, @@2, @@3) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JVARWS (2, @@2, @@3) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JVARS (3, @@2, @@3) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JVARWS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList, weightExpList)'
COMMENT 'Computes the weighted variance value of a data set (expList) with skip instructions';


/** 
 * Register function varp 
 */
CREATE MACRO $1.'@JVARP'(GROUP)
AS '@_JVARP(@@S)' 
SPEC '@JVARP(expList)'
COMMENT 'Computes the variance(p) of non-missing values in a data set (expList)';

CREATE FUNCTION $1.'@_JVARP' 
AS 'com.hyperion.essbase.calculator.Statistics.varp(double [])';

/**
 * Register function weighted varp
 */
CREATE FUNCTION $1.'@JVARPW' 
AS 'com.hyperion.essbase.calculator.Statistics.varp(double [],double [])' 
SPEC '@JVARPW(@LIST(expList), @LIST(weightExpList))'
COMMENT 'Computes the weighted variance(p) of non-missing values in a data set (expList)';


/** 
 * Register functions varp and weighted varp with a skip instruction. 
 * These functions will be used through macros, so no spec/comment specified.
 * Since these functions will not be used directly, the names start with '@_'.
 */
CREATE FUNCTION $1.'@_JVARPS' 
AS 'com.hyperion.essbase.calculator.Statistics.varp(int,double [])';
CREATE FUNCTION $1.'@_JVARPWS' 
AS 'com.hyperion.essbase.calculator.Statistics.varp(int,double [],double [])';


/**
 * Register macro for varp with a skip instruction
 */
CREATE MACRO $1.'@JVARPS'(SINGLE,GROUP) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JVARPS (0, @@2) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JVARPS (1, @@2) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JVARPS (2, @@2) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JVARPS (3, @@2) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JVARPS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList)'
COMMENT 'Computes the variance(p) value of a data set (expList) with skip instructions';


/**
 * Register macro for weighted varp with a skip instruction
 */
CREATE MACRO $1.'@JVARPWS'(SINGLE,SINGLE,SINGLE) 
AS 
'@@IFSTRCMP (@@1, SKIPNONE) 
   @_JVARPWS (0, @@2, @@3) 
 @@ELSE 
   @@IFSTRCMP (@@1, SKIPMISSING) 
     @_JVARPWS (1, @@2, @@3) 
   @@ELSE 
     @@IFSTRCMP (@@1, SKIPZERO) 
       @_JVARPWS (2, @@2, @@3) 
     @@ELSE 
       @@IFSTRCMP (@@1, SKIPBOTH) 
         @_JVARPS (3, @@2, @@3) 
       @@ELSE 
         @@ERROR (@@L1, @_INVALIDSKIP) 
       @@ENDIF 
     @@ENDIF 
   @@ENDIF 
 @@ENDIF'
SPEC '@JVARPWS(SKIPNONE|SKIPZERO|SKIPMISSING|SKIPBOTH, expList, weightExpList)'
COMMENT 'Computes the weighted variance(p) value of a data set (expList) with skip instructions';