Eliminazione dei valori delle celleCiao,
Ho una tabella simile come mostrato di seguito:
1. La tabella ha colonne numeriche x_1, x_2, x3, ...
2. Voglio eliminare un valore specifico, ad esempio 8, da tutte le righe di cols x_1, x_2, x_3, ... . (Anche la tabella o/p richiesta è mostrata di seguito.)
Tabella di input
| UN |
B |
C |
x_1 |
x_2 |
x_3 |
x_4 |
x_5 |
x_6 |
E |
| |
|
|
1 |
8 |
2 |
7 |
2 |
2 |
|
| |
|
|
2 |
8 |
8 |
8 |
8 |
8 |
|
| |
|
|
8 |
8 |
2 |
5 |
3 |
8 |
|
Tabella di output richiesta
| UN |
B |
C |
x_1 |
x_2 |
x_3 |
x_4 |
x_5 |
x_6 |
E |
| |
|
|
1 |
. |
2 |
7 |
2 |
2 |
|
| |
|
|
2 |
. |
. |
. |
. |
. |
|
| |
|
|
. |
. |
2 |
5 |
3 |
. |
|
Il mio copione è allegato...
Grazie in anticipo per l'aiuto/feedback 
dt = Current Data Table ();
for (i=1, i<=6, i++, //iterate through columns loop
temp = "x_" || char (i); //column name
dt << Go To (temp); //select column
dt << Select Where (temp==8);// Select rows where value is 8 ***PROBLEM*** Not selecting rows :(
//After selecting rows where value is 8 for a specific column, I want to delect the value...May be use Empty() ??
);
Re: Cancellare i valori delle celleEcco una piccola modifica allo script precedente che farà quello che vuoi
names default to here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
// set some height rows to missing
dt:height[6] = .;
dt:height[14] = .;
r = loc(ismissing(dt[0, 4]));
// set the values in column 5(wieght) to missing
// for the rows found(located) in column 4
dt[r, 5] = .;Re: Cancellare i valori delle celleInteressante.Ho un'esigenza leggermente diversa per qualcosa di simile.
Diciamo che ho 2 colonne A e B.A dovrebbe avere data/ora e B ha un valore chiave.Ho righe in cui manca la data/ora ma la colonna B ha una chiave.
Come posso eliminare il valore della chiave quando mancano la data/ora.
Re: Cancellare i valori delle celleAnche l'abbonamento alla tabella dati è un'opzione, nel caso in cui sia più veloce per la tua situazione.
dt = open("$SAMPLE_DATA/Big Class.jmp");
r = loc(dt[0, 4]==61)
dt[r, 4] = .;Re: Cancellare i valori delle celleMolte grazie!
Stavo pensando di usare un ciclo per accedere alle righe in modo iterativo e poi cambiarlo, ma questo è un modo molto carino di usare JSL 
<SPAN class="token function">Column</SPAN><SPAN class="token punctuation">(</SPAN> dt<SPAN class="token punctuation">,</SPAN> ColList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">[</SPAN>dt <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN> get rows where<SPAN class="token punctuation">(</SPAN> <SPAN class="token function">As Column</SPAN><SPAN class="token punctuation">(</SPAN> dt<SPAN class="token punctuation">,</SPAN> ColList<SPAN class="token punctuation">[</SPAN>i<SPAN class="token punctuation">]</SPAN> <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator">==</SPAN> <SPAN class="token number">8</SPAN> <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">]</SPAN> <SPAN class="token operator">=</SPAN> <SPAN class="token punctuation">.</SPAN><SPAN class="token punctuation">;</SPAN>
Re: Cancellare i valori delle celleStai affrontando correttamente il problema, hai solo alcuni problemi di sintassi.Di seguito è riportata una versione funzionante del tuo codice
Names Default To Here( 1 );
dt = Current Data Table();
// Select the columns to be evaluated
// ColList = {"x_1","x_2","x_3","x_4","x_5","x_6"};
// or if there is a programmatic way to get the list,
// do something like below
ColList = dt << get column names( numeric, string );
// Loop backwards through the list so the "i" index
// maintains it's proper reference
For( i = N Items( ColList ), i >= 1, i--,
If( Left( ColList[i], 2 ) != "x_",
ColList = Remove( ColList, i, 1 )
)
);
// Loop across ColList and set the values qualified
// values to missing
For( i = 1, i <= N Items( ColList ), i++,
// The line below takes advantage of a JMP feature where
// you can change specific values in a column in one statement
// by just using a matrix of the rows you want to change
// Column A[5,6,9,22] = 4;
// This would set a column named "Column A"'s rows 5,6,9 and 22
// to the value of 4
// In your case, you want to eliminate the cell value, so the
// line sets the value to a missing value, which in JMP is "."
Column( dt, ColList[i] )[dt << get rows where( As Column( dt, ColList[i] ) == 8 )] = .;
);