回复:有关逻辑运算选择的问题如果缺少x,则isMissing(x)返回1;如果不缺少x,则返回0。您也可以使用
isMissing(x)而不将其与1或0进行比较;返回的值是相同的,但可能更易于阅读:
If( :Height > "60" & isMissing( :Weight ) , ... )
or
If( :Height > "60" & ! isMissing( :Weight ) , ... )
注意!意思是不 。
回复:有关逻辑运算选择的问题谢谢你的作品有关逻辑运算选择的问题当我使用以下脚本时,第4行不会更改为“是”,但其他行也会更改。您能再帮忙检查一下吗?我的目的是要意识到,当:Height>“ 60”&(and)isMissing(:Weight)== 0时,都意识到,然后高度值更改为“ Yes”,其他值高度不变。
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Set the value of JACLYN's weight to missing
// to allow for the test case, where the
// :Height is greater than 60, but the :Weight
// is missing
dt:Weight[4] = .;
// Since the column :height is numeric and a
// character value of "Yes" is to be placed in
// that column, the column needs to be changed
// to Data Type of Character
dt:Height << data type(character);
// Now a For Each Row() with a two level
// comparison can be used to change the
// described value
For Each Row(
If( :Height > "60" & isMissing( :Weight ) == 0,
:Height = "Yes"
)
);
