回复:有關邏輯運算選擇的問題如果缺少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"
)
);
