Seleziona dove e sottoinsieme in base al valore della cellaCIAO,
Ho il pezzo di codice seguente in cui voglio che ottenga i nomi delle colonne dal file e quindi crei una nuova tabella di sottoinsiemi seguita dalla ricerca della media e della SD di tutte le colonne numeriche. Il codice Media e SD funziona ma non crea affatto la tabella dei sottoinsiemi. Qualche idea? Ho controllato questo rispetto a tutte le discussioni pubblicate. Ho provato sia le condizioni Inizia con che quelle Contiene
Ecco il file di esempio:
| Numero di serie |
Codice |
La zona |
Altezza |
Peso |
Età |
| 1 |
55414 |
Minneapolis N |
|
|
|
| 2 |
55455 |
Minneapolis S |
|
|
|
| 3 |
4446804e |
Minneapolis E |
|
|
|
| 4 |
4389568 |
Minneapolis W |
|
|
| 5 |
g58934 |
San Paolo N |
|
|
|
| 6 |
4989034 |
San Paolo E |
|
|
|
| 7 |
3496f |
Di San Paolo |
|
|
|
| 8 |
5404390sfd |
Minneapolis E |
|
|
|
| 9 |
43960 |
Minneapolis N |
|
|
|
| 10 |
569043 |
San Paolo N |
|
|
|
| 11 |
6590549 |
San Paolo E |
|
|
|
dt3 = Open( "file_28.jmp" );
colcmp = "Area";
col = dt3 << get column names( string );
nc = N Items( col );
Show( nc );
For( j = 1, j <= nc, j++,
colname = Column( j ) << Get Name;
Show( colname );
If( Contains( colname, colcmp ),
dt3 << Select Where( Starts With( :colname, "Minneapolis" ) );
dt3 << Subset( Output Table Name( "MPLS" ), Selected Rows( 1 ), Selected columns only( 0 ) );
dt3 << Select Where( Starts With( :colname, "St. Paul" ) );
dt3 << Subset( Output Table Name( "STP" ), Selected Rows( 1 ), Selected columns only( 0 ) );
);
);
dtPM = Data Table( "MPLS" );
a = "Numeric";
colPM = dtPM << get column names( string );
ncPM = N Items( colPM );
Show( ncPM );
For( k = 1, k <= ncPM, k++,
colname = Column( k ) << Get Name;
Show( colname );
which = dtPM:colname << Get Data Type;
Show( which );
If( Contains( which, a ),
count = count + 1;
colnames2[count] = colname || "_MPLS";
Mean1[count] = Col Mean( :Column( k ) );
Std1[count] = Col Std Dev( :Column( k ) );
Show( Mean1[count] );
);
);
Combinazione e pulizia dei datiRe: Seleziona dove e sottoinsieme in base al valore della cellaGrazie Jim. Stavo avendo confusione su come passare le variabili che memorizzano i nomi delle colonne alle funzioni e non riuscivo davvero a trovare esempi. Questo ha cancellato l'errore.
Re: Seleziona dove e sottoinsieme in base al valore della cellaStai dicendo a JMP di trovare una colonna denominata :colname.In questo riferimento, JMP non valuterà il riferimento alla colonna oltre :colname.Quello che devi fare è specificare il nome in una funzione As Column().Allora funzionerà
For( j = 3, j <= nc, j++,
colname = Column( j ) << Get Name;
Show( colname );
If( Contains( colname, colcmp ),
dt3 << Select Where( Starts With( as column(colname), "Minneapolis" ) );
dt3 << Subset( Output Table Name( "MPLS" ), Selected Rows( 1 ), Selected columns only( 0 ) );
dt3 << Select Where( Starts With( as column(colname), "St. Paul" ) );
dt3 << Subset( Output Table Name( "STP" ), Selected Rows( 1 ), Selected columns only( 0 ) );
);
);