级别:初学者
Mike Muhlada,SAS JMP 开发测试员
Audrey Shull,SAS JMP 高级开发测试经理
此入门演示将使用示例来解释公式编辑器的机制,调查和修复常见错误,并巩固公式创建的最佳实践和有用的“技巧”。详细的演示将涵盖公式生成器的各个方面,包括如何使用拖放、键盘快捷键和功能按钮来创建公式。在我们处理示例时,我们将讨论有用的函数,发现和纠正常见错误等等。要涵盖的最佳实践主题包括自定义格式、使用公式进行数据“清理”、列转换、字符串操作、JMP 日期函数以及使用中间列构建更复杂的公式。将特别强调 JMP 14 的新功能,包括用户定义的函数、结果预览、“实时”公式错误/警告检测和可自定义的函数列表。
// 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_);