/* <maxl version="11.1.1" encoding="UTF-8"/> */ /** * This script registers methods of the class Statistics as global custom-defined functions * Usage: Log in to MaxL Shell, then call: msh reglobal.mxl * */ /** * Register function average */ CREATE MACRO '@JAVG'(GROUP) AS '@_JAVG(@@S)' SPEC '@JAVG(expList)' COMMENT 'Computes the average of non-missing values in a data set (expList)'; CREATE FUNCTION '@_JAVG' AS 'com.hyperion.essbase.calculator.Statistics.avg(double [])'; /** * Register function weighted average */ CREATE FUNCTION '@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 '@_JAVGS' AS 'com.hyperion.essbase.calculator.Statistics.avg(int,double [])'; CREATE FUNCTION '@_JAVGWS' AS 'com.hyperion.essbase.calculator.Statistics.avg(int,double [],double [])'; /** * Register macro for average with a skip instruction */ CREATE MACRO '@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 '@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 '@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 '@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 '@JCOUNT'(GROUP) AS '@_JCOUNT(@@S)' SPEC '@JCOUNT(expList)' COMMENT 'Computes the count of non-missing elements in a data set (expList)'; CREATE FUNCTION '@_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 '@_JCOUNTS' AS 'com.hyperion.essbase.calculator.Statistics.count(int,double [])'; /** * Register macro for count with a skip instruction */ CREATE MACRO '@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 '@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 '@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 '@JGEOMEAN'(GROUP) AS '@_JGEOMEAN(@@S)' SPEC '@JGEOMEAN(expList)' COMMENT 'Computes the geometric mean of a data set (expList)'; CREATE FUNCTION '@_JGEOMEAN' AS 'com.hyperion.essbase.calculator.Statistics.geomean(double [])'; /** * Register function weighted geometric mean */ CREATE FUNCTION '@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 '@JHARMEAN'(GROUP) AS '@_JHARMEAN(@@S)' SPEC '@JHARMEAN(expList)' COMMENT 'Computes the harmonic mean of a data set (expList)'; CREATE FUNCTION '@_JHARMEAN' AS 'com.hyperion.essbase.calculator.Statistics.harmean(double [])'; /** * Register function weighted harmonic mean */ CREATE FUNCTION '@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 '@JKURT'(GROUP) AS '@_JKURT(@@S)' SPEC '@JKURT(expList)' COMMENT 'Computes the kurtosis of a data set (expList)'; CREATE FUNCTION '@_JKURT' AS 'com.hyperion.essbase.calculator.Statistics.kurt(double [])'; /** * Register function weighted kurtosis */ CREATE FUNCTION '@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 '@JMAX'(GROUP) AS '@_JMAX(@@S)' SPEC '@JMAX(expList)' COMMENT 'Computes the maximum of a data set (expList)'; CREATE FUNCTION '@_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 '@JMEDIAN'(GROUP) AS '@_JMEDIAN(@@S)' SPEC '@JMEDIAN(expList)' COMMENT 'Computes the median of a data set (expList)'; CREATE FUNCTION '@_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 '@JMIN'(GROUP) AS '@_JMIN(@@S)' SPEC '@JMIN(expList)' COMMENT 'Computes the minimum of a data set (expList)'; CREATE FUNCTION '@_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 '@JMODE'(GROUP) AS '@_JMODE(@@S)' SPEC '@JMODE(expList)' COMMENT 'Computes the mode of a data set (expList)'; CREATE FUNCTION '@_JMODE' AS 'com.hyperion.essbase.calculator.Statistics.mode'; /** * Register function percentile */ CREATE MACRO '@JPTILE'(SINGLE, GROUP) AS '@_JPTILE(@@1, @@SH1)' SPEC '@JPTILE(percent,expList)' COMMENT 'Computes the specified (percent) percentile of a data set (expList)'; CREATE FUNCTION '@_JPTILE' AS 'com.hyperion.essbase.calculator.Statistics.percentile(double,double [])'; /** * Register function product */ CREATE MACRO '@JPROD'(GROUP) AS '@_JPROD(@@S)' SPEC '@JPROD(expList)' COMMENT 'Computes the product of non-missing values in a data set (expList)'; CREATE FUNCTION '@_JPROD' AS 'com.hyperion.essbase.calculator.Statistics.product(double [])'; /** * Register function weighted product */ CREATE FUNCTION '@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 '@JQTILE'(SINGLE, GROUP) AS '@_JQTILE(@@1, @@SH1)' SPEC '@JQTILE(quart,expList)' COMMENT 'Computes the specified (quart) quartile of a data set (expList)'; CREATE FUNCTION '@_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 '@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 '@_JRANK' AS 'com.hyperion.essbase.calculator.Statistics.rank'; /** * Register function skewness */ CREATE MACRO '@JSKEW'(GROUP) AS '@_JSKEW(@@S)' SPEC '@JSKEW(expList)' COMMENT 'Computes the skewness of a data set (expList)'; CREATE FUNCTION '@JSKEW' AS 'com.hyperion.essbase.calculator.Statistics.skew(double [])'; /** * Register function weighted skewness */ CREATE FUNCTION '@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 '@JSTDEV'(GROUP) AS '@_JSTDEV(@@S)' SPEC '@JSTDEV(expList)' COMMENT 'Computes the standard deviation of non-missing values in a data set (expList)'; CREATE FUNCTION '@_JSTDEV' AS 'com.hyperion.essbase.calculator.Statistics.stdev(double [])'; /** * Register function weighted stdev */ CREATE FUNCTION '@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 '@_JSTDEVS' AS 'com.hyperion.essbase.calculator.Statistics.stdev(int,double [])'; CREATE FUNCTION '@_JSTDEVWS' AS 'com.hyperion.essbase.calculator.Statistics.stdev(int,double [],double [])'; /** * Register macro for stdev with a skip instruction */ CREATE MACRO '@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 '@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 '@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 '@JSTDEVP' AS 'com.hyperion.essbase.calculator.Statistics.stdevp(double [])'; /** * Register function weighted stdevp */ CREATE FUNCTION '@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 '@_JSTDEVPS' AS 'com.hyperion.essbase.calculator.Statistics.stdevp(int,double [])'; CREATE FUNCTION '@_JSTDEVPWS' AS 'com.hyperion.essbase.calculator.Statistics.stdevp(int,double [],double [])'; /** * Register macro for stdevp with a skip instruction */ CREATE MACRO '@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 '@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 '@JSUM'(GROUP) AS '@_JSUM(@@S)' SPEC '@JSUM(expList)' COMMENT 'Computes the sum of a data set (expList)'; CREATE FUNCTION '@_JSUM' AS 'com.hyperion.essbase.calculator.Statistics.sum(double [])'; /** * Register function weighted SUM */ CREATE FUNCTION '@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 '@JVAR'(GROUP) AS '@_JVAR(@@S)' SPEC '@JVAR(expList)' COMMENT 'Computes the variance of non-missing values in a data set (expList)'; CREATE FUNCTION '@_JVAR' AS 'com.hyperion.essbase.calculator.Statistics.var(double [])'; /** * Register function weighted var */ CREATE FUNCTION '@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 '@_JVARS' AS 'com.hyperion.essbase.calculator.Statistics.var(int,double [])'; CREATE FUNCTION '@_JVARWS' AS 'com.hyperion.essbase.calculator.Statistics.var(int,double [],double [])'; /** * Register macro for var with a skip instruction */ CREATE MACRO '@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 '@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 '@JVARP'(GROUP) AS '@_JVARP(@@S)' SPEC '@JVARP(expList)' COMMENT 'Computes the variance(p) of non-missing values in a data set (expList)'; CREATE FUNCTION '@_JVARP' AS 'com.hyperion.essbase.calculator.Statistics.varp(double [])'; /** * Register function weighted varp */ CREATE FUNCTION '@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 '@_JVARPS' AS 'com.hyperion.essbase.calculator.Statistics.varp(int,double [])'; CREATE FUNCTION '@_JVARPWS' AS 'com.hyperion.essbase.calculator.Statistics.varp(int,double [],double [])'; /** * Register macro for varp with a skip instruction */ CREATE MACRO '@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 '@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';