CIAO
Sto cercando di sottoporre a sottoinsieme tutti i dati nella riga il cui valore nella colonna: "è rifiutato?" ==Y alla nuova tabella chiamata rifiutato
Ho provato diversi metodi ma nessuno funziona e ricevo l'errore:
""Split_dt" inaspettato. Forse manca un ";" o ",".
Riga 77 Colonna 1: ►Split_dt << Select Dove( :is rifiuta? == "Y" );"
questo codice fa parte di uno script più grande che crea la colonna :" è rifiutato?"
quando eseguo tutti gli script ottengo l'errore di cui sopra, ma quando li eseguo separatamente funziona.
cosa posso fare per risolvere il problema?
opzione 1:
rejects = Split_dt << Subset(
Where(:is rejects? == "Y"),
Output Table Name("rejects"),
All Columns
);
opzione2:
Split_dt << Select Where(:is rejects? == "Y");
rejects = Split_dt << Subset(Output Table Name("rejects"), All Columns);
la sceneggiatura completa:
Split_dt = Current Data Table();
Split_dt << New Column("is rejects?", character, Formula("N"));
Column(Split_dt, "is rejects?") << Delete Formula;
// Get the number of columns in the data table
numCols = N Cols(Split_dt);
// Iterate over each row in the data table
For Each Row(
// Iterate over each column starting from column 6
For(colIndex = 6, colIndex <= numCols, colIndex++,
// Get the column reference
currentCol = Column(Split_dt, colIndex);
// Check if the value in the current cell is greater than 100 and "is rejects?" is "N"
If(
currentCol[] > 100 & :is rejects? == "N" & Contains(currentCol << Get Name, "BI")
== 0,
// Change the value in the "is rejects?" column to "Y"
:is rejects? = "Y";
// Exit the loop early since we only need one match
Break();
);
)
);
rejects = Split_dt << Subset(
Where(:is rejects? == "Y"),
Output Table Name("rejects"),
All Columns
);
Di solito utilizzo Rows() quando eseguo il sottoinsieme di righe specifiche (è possibile anche eseguire il sottoinsieme di righe selezionate, ma in genere si finisce per eseguire selezioni non necessarie nella tabella).
Questo esempio sottoinsieme tutte le righe che hanno sesso == "F"
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
rows_to_subset = dt << get rows where(:sex == "F");
dt_subset = dt << Subset(Rows(rows_to_subset), Output Table("Subset F"));Grazie per la rapida risposta.
la soluzione che hai suggerito dà lo stesso errore:(
Quale versione di JMP stai utilizzando? Hai provato il mio script di esempio?
Tentativo
rejects = Split_dt << Subset(
Filtered Rows(:is rejects? == "Y"),
Output Table Name("rejects"),
All Columns
);