在 JSL 的特定列中查找并替换包含特定值范围的数据你好!全部,
我想使用 jmp 脚本查找并替换特定列中包含特定值范围的数据
但是代码没有生效
这是我的代码,它想要遍历“标记”列中的数据并查找超过 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
);
);
);