该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


New Custom Function(
"custom", // namespace in which new function resides
"x1000", /* function name. The completely scoped name is
Function( {x}, x * 1000 ),
<<Transform Category( 1 )
// optional message to enables this as a custom transform
图 9.10 Custom Transform in a Data Table
The last type of custom function is a custom format. You create custom formats using New Custom Function() and by specifying the Custom Format Category(1) message. Here’s an example that multiplies an input variable by 2 and also displays (x2) after the value. Note that, in this example, this function persists as a custom format and in the formula category “My New Category”. This allows you to use the format in a column formula or as a custom format.
New Custom Function(
"myNamespace",
"Times 2",
Function( {inputVar},
Char( inputVar * 2 ) || " (x2)"
<<Description( "Multiply input by 2. Display (x2) after the new value." ),
<<Formula Category( "My New Category" ),
<<Custom Format Category( 1 )
By specifying the Custom Format Category(1) message, this format now persists under the Custom Function category in the Format menu. Here’s what this looks like when applying this new Times 2 custom format in the Column Info window:
图 9.11 Custom Format in the Col Info Window
New Custom Function(
"myNamespace",
"DateYMD_Day",
Function( {inputVar},
Char(
Match( Month( inputVar ),
1, "January ",
2, "February ",
3, "March ",
4, "April ",
5, "May ",
6, "June ",
7, "July ",
8, "August ",
9, "September ",
10, "October ",
11, "November ",
12, "December "
) || Char( Year( inputVar ) ) || ", Day#" || Char( Day( inputVar ) ) || "-" ||
Char(
Match( Day Of Week( inputVar ),
1, "Sunday",
2, "Monday",
3, "Tuesday",
4, "Wednesday",
5, "Thursday",
6, "Friday",
7, "Saturday"
<<Description(
"Date format showing Month, Year, Day and Day of Week \nfor example, April 1930, Day#29-Tuesday"
<<Custom Format Category( 1 )