尋找並取代 JSL 中特定列中包含特定值範圍的數據你好!全部,
我想使用 jmp 腳本查找並替換特定列中包含特定值範圍的數據
然而代碼並沒有生效
這是我的程式碼,想要循環遍歷“mark”列中的資料並查找大於 1000 的值並用 99 替換
Names Default To Here( 1 );
dt = Data Table( "studentmark" );
headerList = dt << get column names( string );
For( i = 1, i <= N Items( headerList ), i++,
If( Contains(headerList[i], "mark"),
dt << Begin Data Update;
For Each Row( dt, As Column( dt, headerList[i]) = Substitute( As Column( dt, headerList[i]) > 1000 , 99 ));
dt << End Data Update;
);
);
有誰知道程式碼出了什麼問題?
感謝您的幫助。 謝謝
進階統計建模自動化和腳本編寫資料混合與清理實驗設計品質和工藝工程回覆:尋找並取代 JSL 中特定列中包含特定值範圍的數據我假設您希望將 1000 以上的所有值轉換為 99,如果是這樣,下面的腳本將比使用 For Each Row() 更有效地完成此操作
Names Default To Here( 1 );
dt = Data Table( "studentmark" );
headerList = dt << get column names( string );
For( i = 1, i <= N Items( headerList ), i++,
If( Contains( headerList[i], "mark" ),
theRows = dt << get rows where( As Column( headerList[i] ) > 1000 );
If( Length( theRows ) > 0,
Column( headerList[i] )[theRows] = 99
);
);
);