Hola, mi nombre es Jamal. Soy de Malasia y realmente no tengo conocimiento sobre la creación de secuencias de comandos JSL. Entonces, mi proyecto es, cada tabla que abro desde Data Wafer, viene con filas y columnas no deseadas. Entonces, mi objetivo es que los datos solo funcionen si el parámetro de fila de nombre y otros son una columna nueva. También debo eliminar alguna fila específica que no usé. Así que mi pregunta para alguien experto en secuencias de comandos. ¿Puede escribir el programa que si elijo cualquier tabla de datos, automáticamente elimina la otra fila dentro del marcador rojo y crea un parámetro de fila como una nueva columna?
P/s no todas las tablas de datos tienen un mismo parámetro de fila (44)
Esto podría hacer el truco:
Names Default to Here( 1 );
dt = Current Data Table();
loc = Contains( Column( dt, 1 ) << Get Values, "Parameter" );
dt << Select Rows( 1::loc - 1 ) << Delete Rows;
loc = Contains( Column( dt, 1 ) << Get Values, "PID-1" );
dt << Select Rows( 2::loc - 1 ) << Delete Rows;
For( i = 1, i <= N Col( dt ), i++,
Column( dt, i ) << Set Name( Column( dt, i )[1] )
);
dt << Select Rows( [1] ) << Delete Rows
Esta es la forma en que abordaría el problema.Abra el archivo csv en JMP y luego ejecute este script a continuación.Cargará los datos globales en las variables de la tabla, cambiará los nombres de las columnas y luego convertirá las columnas de prueba en números, etc.
Names Default To Here( 1 );
dt = Current Data Table();
// Add Global info as table variables
theRow = 1;
While( Column( dt, 1 )[theRow] != "Parameter",
If( Column( dt, 2 )[theRow] != "",
dt << new table variable( Column( dt, 1 )[theRow],
Column( dt, 2 )[theRow]
)
);
theRow++;
);
// Get rid of unwanted rows
dt << select where( As Column( dt, 3 ) == "" & As Column( dt, 4 ) == "" );
dt << delete rows;
// Rename columns
theRow = (dt << get rows where( As Column( dt, 1 ) == "Parameter" ))[1];
For( i = 1, i <= N Cols( dt ), i++,
If( Column( dt, i )[theRow] != "",
Column( dt, i ) << set name( Column( dt, i )[theRow] )
)
);
dt << delete rows(theRow);
// Attempt to set meta data for columns
// List of know columns
metaList = {
"SBIN", "numeric", "ordinal",
"HBIN", "numeric", "ordinal",
"DIE_X", "numeric", "ordinal",
"DIE_Y", "numeric", "ordinal",
"SITE", "numeric", "ordinal",
"TOTAL_TESTS", "numeric", "continuous",
"X", "numeric", "ordinal",
"Y", "numeric", "ordinal",
"SITE_NO", "numeric", "ordinal",
"PassFail", "numeric", "ordinal",
"TimeStamp", "numeric", "timestamp",
"PartSN", "character", "nominal"
};
// Process metaList into separate lists for easier processing
colList = {};
typeList = {};
modelList = {};
For( i = 1, i <= N Items( metaList ), i++,
If(
Mod( i, 3 ) == 1, Insert Into( colList, metaList[i] ),
Mod( i, 3 ) == 2, Insert Into( typeList, metaList[i] ),
Insert Into( modelList, metaList[i] )
)
);
For( i = 1, i <= N Cols( dt ), i++,
foundName = Contains( colList, Column( dt, i ) << get name );
If(
foundName,
If(
Contains( {"ordinal", "nominal", "continuous"}, modelList[foundName] ),
Column( dt, i ) << dataType( typeList[foundName] ) << modelingtype( modelList[foundName] ),
modelList[foundName] == "timestamp",
For( k = 1, k <= N Rows( dt ), k++,
Column( dt, i )[k] = Word( 1, Char( Column( dt, i )[k] ), "_ " ) || "/" || Word( 2, Char( Column( dt, i )[k] ), "_ " ) || "/"
|| Word( 3, Char( Column( dt, i )[k] ), "_ " ) || " " || Word( 2, Char( Column( dt, i )[k] ), " " )
);
Column( dt, i ) << datatype( numeric ) << modelingtype( continuous ) << set informat( "y/m/d h:m:s" ) <<
Format( "y/m/d h:m:s", 18, 0 );,
),
Is Missing( Num( Column( dt, i )[1] ) ) == 0,
Column( dt, i ) << datatype( numeric ) << modelingtype( continuous );
);
);