How to script changing column data type to Numeric when the rows are a mix of string and numbersI have a data column where some rows are string and some rows are numbers. When I manually convert the Data Type from Character to Numeric, the strings disappear leaving only the text rows. This is the exact result I would like to replicate via JSL. However when I run a script that performs the same functions it does not change the Data Type for the column.
Attached is a screen recording showing both the script not acting on the column and the manual process of changing the Data Type with desired result.
Automation and ScriptingQuality and Process EngineeringRe: How to script changing column data type to Numeric when the rows are a mix of string and numbersYour JSL syntax is incorrect. It should be:
dt=current data table();
dt:example << data type(numeric)<<FORMAT></FORMAT>
Re: How to script changing column data type to Numeric when the rows are a mix of string and numbersThis example shows how to do it.
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
test = dt << New Column( "Test", Character, Nominal,
Values({
"Mark",
"Jane",
"5.37",
"3.14",
"Linda",
"1.732"
})
);
Wait( 2 );
test << Set Data Type( Numeric );