Function Categories
The Prophet programming language provides a wide range of functions which are grouped into the following categories:
- Array functions
- Conversion functions
- Dynamic functions
- Error / Warning functions
- Financial functions
- Logical functions
- Mathematical functions
- Product functions
- Read functions
- Run Position functions
- Run Progress functions
- Run Setting functions
- Statistical functions
- Text functions
- Trigonometric functions
Array Functions
| Function | Description |
| ARRAY_INITIALISE | Resizes the specified array where necessary and always resets the array entries to null. |
| ARRAY_MAX | Returns the maximum value of an array expression. |
| ARRAY_MIN | Returns the minimum value of an array expression. |
| ARRAY_PROD | Returns the product of the values of an array expression. |
| ARRAY_SIZE | Returns the size of an array dimension. |
| ARRAY_SUM | Returns the summation of the values of an array expression. |
Conversion Functions
| Function | Description |
| ENUM_SIZE | Returns the size of an enumeration |
| ENUM_TO_INT | Returns the integer value of the enumeration |
| ENUM_TO_TEXT | Returns the text value of the enumeration |
| INT_TO_ENUM | Converts an integer into the specified enumeration type |
| NUM_TO_TEXT | Converts the value of a numeric variable to a text string. |
| TEXT_TO_ENUM | Converts a text string into the corresponding enumeration |
| TEXT_TO_NUM | Returns the value of a text string variable to a number. |
Dynamic Functions
| Function | Description |
| BUY_ASSET | Specifies a purchase of assets. Not available in an extended formula definition but is available in a t-dependent extended definition. |
| CURRENT_START_MONTH | Returns the Start Month for the current dynamic loop |
| CURRENT_START_YEAR | Returns the Start Year for the current dynamic loop |
| FIRST_CALC | Returns 1 if called in the first dynamic loop, otherwise 0 (if Loop at Start is selected in the Run Setting this function only returns 1 in the loop at start) |
| SELL_ASSET | Specifies a sale of assets Not available in an extended formula definition but is available in a t-dependent extended definition. |
| PROP_BUY_ASSET | Instructs the system to buy a specified amount of assets at the start of the next dynamic loop. Not available in an extended formula definition but is available in a t-dependent extended definition. |
Error / Warning Functions
| Function | Description |
| ERROR | Displays text in the runlog and terminates the calculation of that model point. It will also cause the product to be terminated if the error limit has then been exceeded. |
| WARNING | Displays text in the runlog. The calculation of that model point continues with a value of zero being returned by the function. |
Financial Functions
| Function | Description |
| BEM | Returns the break-even month. That is, the first value of t for which a variable has a positive value |
| BLACK_SCH | Returns a Black-Scholes value for use in valuing options and other derivatives |
| IRR(X) | Returns the internal rate of return for the time dependent variable x(t). The rate of return is expressed as a percentage i.e. 12.0 is returned and not 0.12. |
| MONINT(X) | Annual interest rate x, converted to monthly interest rate, that is monint(x) = (1+x)^(1/12) – 1 Note that x should be expressed as a proportion eg 0.06 rather than 6 |
Logical Functions
| Function | Description |
| MULT(X,N) | Returns true if x is a multiple of n, else false. n must be an integer such as 12; it cannot be a variable name. |
Mathematical Functions
| Function | Description |
| ABS | Take the absolute value |
| DIV(X,Y) | Integer value of x/y |
| EXP(X) | Exponential value |
| FRACT(X) | Take the fractional part |
| GAUSS_JORDAN_SOLVE | This function is used to solve a linear equation using Gauss Jordan elimination |
| GROUP_AFTER(X) | Returns zero but forces the variable whose formula uses the function to be calculated in a later group than the variable specified in the argument. |
| INT(X) | Take the integer part |
| INTERP(X(T),N) | Interpolated value of x(t) using steps of n Not available in an extended formula definition. |
| LN(X) | Natural logarithm |
| LOG(X) | Base 10 logarithm |
| MAX(X1,X2,…,XN) | Maximum value of x1, x2, …, xn (there must be at least two arguments). |
| MAXT | Returns the maximum value of a variable for a specified range of values of t. Not available in an extended formula definition. |
| MIN(X1,X2,…,XN) | Minimum value of x1, x2, …, xn (there must be at least two arguments) |
| MINT | Returns the minimum value of a variable for a specified range of values of t. Not available in an extended formula definition. |
| MOD(X,Y) | Remainder of x/y |
| NO_CALC | System variable which prevents any calculation being carried out and hence retains the existing value |
| PROD(T1,T2,X()) | Product of x from t1 to t2 For example, x(t1) * x(t1+1) * … * x(t2). Not available in an extended formula definition. |
| ROUND(X) | Rounding to nearest integer |
| ROUND_DOWN (X,N) |
Round down to n decimal places |
| ROUND_NEAR(X,N) | Round to nearest n decimal places |
| ROUND_UP(X,N) | Round up to n decimal places |
| SUM(T1,T2,X) | Sum of x from t1 to t2 |
| SUM(T1,T2,X()) | For example, x(t1) + x(t1+1) + … + x(t2). Not available in an extended formula definition. |
Product Functions
| Function | Description |
| IMD_PRODUCT | Is a system variable that returns 1 if the product is using in memory dynamic calculations, otherwise 0 |
| IMS_PRODUCT | Is a system variable that returns 1 if the product is using in memory stochastic calculations, otherwise 0 |
| SEP_CALC_ARRAY | Is a system variable that returns 1 if the product is using a separate calculation array for each model point, otherwise 0 |
| STRONG_T_LIMIT | Is a system variable that returns 1 if the product is using strong t-limiting, otherwise 0 |
Read Functions
| Function | Description |
| MORT_MAX_AGE | Returns the maximum age for which values exist in the specified mortality table |
| MORT_MIN_AGE | Returns the minimum age for which values exist in the specified mortality table |
| MORT_RATE | Reads a single value from a specified mortality table for a specified year and duration |
| MORT_SELECT_PERIOD | Returns the select period for the specified mortality table |
| PROJ_RESULT | Returns a value from a Prophet projection or a new business profile results file |
| READ_AIDS_TABLE | Returns a value from an AIDS table. Not available in an extended formula definition. |
| READ_GENERIC_TABLE | Returns a value from a generic table. |
| READ_GENERIC_TABLE_TEXT | Returns a text value from a generic table. |
| READ_GLOBAL | Returns a value from a global file. |
| READ_GLOBAL_TEXT | Returns a text value from a global file. |
| READ_MODEL_POINT | Returns a value from a variable in a model point file. |
| READ_MODEL_POINT_TEXT | Returns a text value from a variable in a model point file. |
| READ_MORT_TABLE | Returns a value from a mortality table. Not available in an extended formula definition. |
| READ_PARAMETER | Returns a value from a parameter file. |
| READ_PARAMETER_TEXT | Returns a text value from a parameter file. |
| READ_PREVIOUS_DYN_LOOP | Returns a value from the previous dynamic loop and stores a value to be returned in the next dynamic loop. Not available in an extended formula definition. |
| READ_RESULTS | Returns a value from a projection or new business profile results file. Not available in an extended formula definition. |
| READ_TABLE_NAME | Returns a string containing the name of a table located in the Table of Tables using the product and run number implicitly and the value of a variable set in the code. |
| READ_TABLE_ROW | Returns a value from a specific row of a generic table. |
| READ_TABLE_ROW_TEXT | Returns a text value from a specific row of a generic table. |
| READ_YEAR_DEP_MORT_TABLE | Returns a value from a year dependent mortality table. Not available in an extended formula definition. |
| READ_YEAR_INDEX_TABLE | Returns a value from a year index table. Not available in an extended formula definition. |
| STOCH_RESULT | Returns a value from a Prophet stochastic results file |
| TABLE_COLUMNS | Returns the number of columns of data in a table. |
| TABLE_ROWS | Returns the number of rows of data in a table. |
| YD_MORT_MAX_AGE | Returns the maximum age for which values exist in the specified year dependent mortality table |
| YD_MORT_MAX_YEAR | Returns the maximum year for which values exist in the specified year dependent mortality table |
| YD_MORT_MIN_AGE | Returns the minimum age for which values exist in the specified year dependent mortality table |
| YD_MORT_MIN_YEAR | Returns the minimum year for which values exist in the specified year dependent mortality table |
| YD_MORT_RATE | Reads a single value from a specified mortality table for a specified age and year |
Run Setting Functions
| Function | Description |
| COM_YEAR_END | Returns company year end month. |
| DYN_LOOPING_PERIOD | Returns the dynamic projection period specified in the Run Setting |
| DYN_PROJ_PERIOD | Returns the dynamic projection period specified in the Run Setting. This function has been renamed from DYN_LOOPING_PERIOD. Both functions are identical in use. |
| DYNAMIC_PERIOD(n) | Returns dynamic period for level number n |
| DYNAMIC_RUN | Returns 1 if Dynamic Run selected, otherwise 0 |
| FUT_ACCUM_Y | Returns the Future Accumulation Period in Years |
| LAST_SPCODE_FOR_EXISTING_BUS | Returns the Last Sub-Product Code number to be treated as Existing Business |
| LAST_SPCODE_FOR_NB_BASED_ON_SALES | Returns the last Sub-Product Code number to be treated as New Business based on Sales Volumes |
| LOOP_AT_END | Returns 1 if Loop at End selected, otherwise 0 |
| LOOP_AT_START | Returns 1 if Loop at Start selected, otherwise 0 |
| NEW_BUS_IN_ACCUMS | Returns 1 if New Business in Initial Accumulations selected, otherwise 0 |
| NEW_BUSINESS_METHOD | Returns 0 if New Business Method is None Returns 1 if New Business Method is Cross Multiplication Returns 2 if New Business Method is New Business in Model Point File Returns 3 if New Business Method is Project |
| PAST_ACCUM_Y | Returns the Past Accumulation Period in Years |
| RESULTS_LOCATION | Returns the locations of external results |
| RESULTS_RETENTION_Y | Returns the number of years for which results will be retained for the current product |
| RUN_IDENT | Returns the Run Identifier Number |
| SET_DYNAMIC_PERIOD(m,n) | Changes the dynamic period to m for level number n with effect from the next year |
| SET_DYNAMIC_PROJ_PERIOD(y) | Changes the dynamic projection period to y with effect from the next year |
| START_MONTH | Returns the month of the Start Date |
| START_YEAR | Returns the year of the Start Date |
| VALN_DAY | Returns the day of the Start Date |
| VALN_MONTH | Returns the month of the Start Date |
| VALN_YEAR | Returns the year of the Start Date |
Run Position Functions
| Function | Description |
| CALC_LOOP | Returns the number of the current calculation loop |
| CURR_DYN_START_T | Returns the first month of the current dynamic loop |
| FIRST_MODEL_POINT | Returns 1 if the first model point in the model point file is being processed. Otherwise, returns 0. |
| ITERATION | Returns the current goal seeking iteration number |
| IN_FIRST_MAIN_LOOP | Returns 1 if called in first main loop, otherwise 0 |
| IN_LAST_MAIN_LOOP | Returns 1 if called in last main loop, otherwise 0 |
| IN_LOOP_AT_START | Returns 1 if called in loop at start, otherwise 0 |
| IN_LOOP_AT_END | Returns 1 if called in loop at end, otherwise 0 |
| INCLUDING_NEW_BUS_IN_ACCUMS | Returns 1 if new business is currently being included in accumulations, otherwise 0 |
| LAST_MODEL_POINT | Returns 1 if the last model point in the model point file is being processed. Otherwise, returns 0 |
| LEVEL_NUMBER | Returns the level number for the current product |
| MOD_POINT_NO | Returns the current model point number |
| REPEAT_COUNT | Returns the number of times a level has been completed |
| RUN_NUMBER | Returns the current run number |
| SIMULATION | Returns the current stochastic simulation number |
| SPCODE | Returns the current sub-product code |
Run Progress Functions
| Function | Description |
| IGNORE_MODEL_POINT | Ignores the current model point |
| IN_MEMORY_START_T | Sets the first time period for recalculation using in-memory dynamic processing |
| REPEAT_LEVEL | Repeats from a specified level number |
| TERMINATE | Terminates the Prophet run |
Run Progress Functions
| Function | Description |
| CTE_CALC | Returns the Conditional Tail Expectation (CTE) as a number that represents the average of outcomes that exceed a specified percentile CTE is also known as Tail Value-at-Risk (TailVar) or Expected Shortfall |
| CUMULATIVE_NORMAL | Returns the standard cumulative normal function of the argument |
| CUMULATIVE_BIVARIATE_NORMAL | Returns the cumulative bivariate normal function for the argument |
| INV_CUMULATIVE_NORMAL | Returns the inverse cumulative normal function of the argument |
| LEGENDRE_P | Returns a polynomial Pn(x) of the first kind |
| RAND_LOGNORMAL | Returns a random sample from a lognormal distribution generated by the parameters supplied |
| RAND_BETA | Returns a random value from a beta distribution with the specified shape parameters |
| RAND_NORMAL | Returns a random sample from a normal distribution generated by the parameters supplied |
| RAND_NUMBER | Returns a random sample or moment from the distribution requested using the parameters supplied |
| RAND_POISSON | Returns a random sample from a Poisson distribution generated by the parameters supplied |
| RAND_SAMPLE | Returns a value from the sample distribution in the specified file |
| RAND_UNIFORM | Returns a random sample from a uniform distribution generated by the parameters supplied |
Text Functions
| Function | Description |
| CPU_ARCHITECTURE | Returns a string that describes the CPU architecture (Intel32 or Intel64) used by a worker machine |
| FIND_FORWARD | Returns an integer that specifies the position of the first occurrence of a text string when searching from the left side of another text string |
| FIND_REVERSE | Returns an integer that specifies the position of the first occurrence of a text string when searching from the right side of another text string |
| JUST_VAR_NAME | Returns the name of the variable without any array dimensions |
| LEFT | Returns a text string containing a specified number of characters from the left side of a string |
| LENGTH | Returns the length of a text string as an integer |
| LIBRARY | Returns the current library name |
| NUM_TO_TEXT | Converts the value of a numeric variable to a text string |
| PROD_NAME | Returns the current product name |
| RIGHT | Returns the right most characters from a text string starting at a specified number of characters from the left |
| SAME_AS_PROD_NAME | For a same as product. Returns the name of the actual product for which the current is the same as |
| SUBSTR | Returns a substring of a string |
| TEXT_TO_NUM | Returns the value of a text string variable to a number |
| VAR_NAME | Returns the current variable name |
| WORKSPACE | Returns the current workspace path |
Text Functions
| Function | Description |
| ACOS | Returns the arccosine of the argument |
| ACOSH | Returns the hyperbolic arccosine of the argument |
| ASIN | Returns the arcsine of the argument |
| ASINH | RReturns the hyperbolic arcsine of the argument |
| ATAN | Returns the arctangent of the argument |
| ATAN2 | Returns the arctangent of the argument1/argument2 |
| ATANH | Returns the hyperbolic arctangent of the argument |
| COS | Returns the cosine of the argument |
| COSH | Returns the hyperbolic cosine of the argument |
| PI | Returns the value of pi, 3.1472… |
| SIN | Returns the sine of the argument |
| SINH | Returns the hyperbolic sine of the argument |
| TAN | Returns the tangent of the argument |
| TANH | Returns the hyperbolic tangent of the argument |
Functions not Supported in Extended Formulas
| BUY_ASSET |
| INTERP |
| MAXT |
| MINT |
| PROD |
| READ_AIDS_TABLE |
| READ_MORTALITY_TABLE |
| READ_PREVIOUS_DYN_LOOP |
| READ_RESULTS |
| READ_RESULTS_LEGACY |
| READ_RESULTS_TEXT_LEGACY |
| READ_YEAR_DEP_MORT_TABLE |
| READ_YEAR_INDEX_TABLE |
| SELL_ASSET |
| SUM |
System Variables
Prophet has a number of system variables that can be used in both the standard Prophet language and the Extended Formula language.
- Rebasing
- REBASE_MTH
- NEW_REBASE_M