Re: Cómo seleccionar filas con 2 tablas de datos diferentes con columna coincidenteAquí hay 3 formas diferentes de hacer esto ... y estoy seguro de que otros pueden tener otras formas de hacerlo
names default to here(1);
dt = Open( "$SAMPLE_DATA/BIG CLASS.JMP" );
dt1 = dt << Subset( Columns( Name ), Output Table Name( "1" ) );
dt1 << Delete Rows( 15 :: 40 );
// Method one, read a name in dt1 and select it in dt, repeat
// for all rows in dt1
dt << clear rowstates;
For(i=1,i<= nrows(dt1),i++,
dt << select where(dt:name == dt1:name[i], current selection("extend"));
);
// Method 2, extract names from dt1 into a list, and then
// compare against the list for the
dt << clear rowstates;
nameList = dt1:name << get values;
dt << select where(contains(nameList,:name));
//Method 3, Update dt with dt1 and select matching rows
// this method would be the fastest on large data tables
dt << clear rowstates;
// add a column to use as a selector
dt1 << New Column( "selector", set each value( 1 ) );
dt << Update( With( dt1 ), Match Columns( :name = :name ) );
dt << select where( :selector == 1 );
dt << delete columns( "selector" );
dt1 << delete columns( "selector" );Re: Cómo seleccionar filas con 2 tablas de datos diferentes con columna coincidenteMuchas graciasCómo seleccionar filas con 2 tablas de datos diferentes con columna coincidente& * el script a continuación no funciona ¿podría ayudarme a depurar y enviarme un script viable? Quiero realizar la función que "selecciona todas las filas" en dt que coincide con la columna: nombre en dt1.
dt = Open( "$SAMPLE_DATA/BIG CLASS.JMP" );
dt1 = dt << Subset( Columns( Name ), Output Table Name( "1" ) );
dt1 << Delete Rows( 15 :: 40 ); // I want to relize the function of "select all rows that (dt:name==dt1:name) dt << Select where( With(dt1), By Matching Columns(name==name), );
;
ScriptingRe: Cómo seleccionar filas con 2 tablas de datos diferentes con columna coincidenteesto es realmente lindo! Usé el método 1.
Necesitaba copiar y pegar la ruta del archivo de mi tabla de datos para que esto funcione. No pude descubrir cómo cambiar el directorio de trabajo para poder escribir los nombres de archivo sin la ruta completa.