Level: Beginner
Mike Muhlada, JMP Development Tester, SAS
Audrey Shull, JMP Senior Development Testing Manager, SAS
This introductory demo will use examples to explain Formula Editor mechanics, to investigate and fix common errors and to solidify best practices and useful ‘tricks’ for formula creation. A detailed walkthrough will cover various aspects of the formula builder, including how to use drag-and-drop, keyboard shortcuts and function buttons to create formulas. As we work the examples, we will discuss useful functions, uncover and correct common mistakes, and more. Best practice topics to be covered include custom formats, using formulas for data ‘cleanup,’ column transforms, string manipulation, JMP Date functions and using intermediate columns to build more complex formulas. Special emphasis will be placed on JMP 14 new features including user-defined functions, result preview, ‘live’ formula error/warning detection and customizable function list.
// 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( "Frankfurt Functions" );
//add myNamespace:AddTen function to system
Add Custom Functions(bmi_);