// custom function funcDef=function( {height, weight}, {Default Local}, (weight * 0.45) / (height * 0.025) ^ 2 ); description="This function calculates BMI, given a person's weight and height. Weight is presumed to be in pounds and Height is presumed to be in inches. The conversion to metric is done inside the function itself."; // Examples can be multiple statements inside expr() ex2=expr( dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); custom:BMI(:height[4], :weight[4]) ); parmHint1="Height in inches"; parmHint2="Weight in pounds"; //create function using variables bmi_=New Custom Function("custom", "BMI", funcDef); bmi_ << Description(description); bmi_ << Prototype("custom:BMI(height,weight)"); bmi_ << Example("custom:BMI(72,225)"); // expr() Examples need to be passed inside NameExpr() bmi_ << Example(NameExpr(ex2)); bmi_ << Parameter("Number", parmHint1); bmi_ << Parameter("Number", parmHint2); bmi_ << Formula Category( "Discovery" ); bmi_ << Scripting Index Category( "Discovery Functions" ); //add myNamespace:AddTen function to system Add Custom Functions(bmi_);