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


The If() function evaluates the first result expression when its condition evaluates as true (a nonzero or nonmissing value). Otherwise, it evaluates the second result expression.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
For Each Row( age = If( :age < 12, "Young", "Young at Heart" ) );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
If(
sex == "F", "Female",
sex == "M", "Male",
"Unknown" );
For each row in the table, sex is the column that is recoded.
Begins the If() loop.
If the value of sex is F, replaces the value with Female.
If the value of sex is M, replaces the value with Male.
y = 25;
z = If( y < 20, x = y, x = 20 );
注意:Be careful to use two equal signs (==) for equality tests, not one equal sign (=). An If with an argument such as name=value assigns rather than tests the value.
You can also try setting the maximum call depth. The Maximum Call Depth preference sets the default for the maximum call depth (or stack size) in which JSL built-in functions, user-defined functions, or Recurse() function calls can be made. By default, the maximum call depth is set to 256.
Preferences[1] << Set( Maximum JMP call depth( 50 ) );