CIAO! Tutto,
Vorrei trovare e sostituire i dati che contengono un determinato intervallo di valori in una colonna specifica utilizzando lo script jmp
Tuttavia, il codice non ha avuto effetto
Ecco il mio codice che vuole scorrere i dati nella colonna "mark" e cercare un valore superiore a 1000 e sostituirlo con 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;
);
);
Qualcuno sa cosa è andato storto con il codice?
Apprezzo gli aiuti. Grazie
Presumo che tu voglia convertire tutti i valori superiori a 1000 in 99, in tal caso, lo script seguente lo farà in modo più efficiente rispetto all'utilizzo di 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
);
);
);