Hi Users,
I read through a prior discussion related to this topic but did not find all the answers.
I would like to know how to create a column subset based on a given list of columns. I know that you can easily do this when the columns in the given list exist in the datatable you would like to subset.
What I want to know is how do you make the script robust so that it does not give the error that "Column not found in access or evaluation of 'Bad Argument' in the case that a given column in the list does not exist.
For example, in my script below, I want to still be able to create a subset of "Big Class.jmp" with columns, name, age and height because they exist but my script breaks down as it is because I have a non-existent column in the given list called, none.
I tried putting Try() around the code but no success.
cols_of_interest = {:name, :age, :height, :none};
show(cols_of_interest);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
big_class_cols = dt << Get Column Names();
show(big_class_cols);
subDt1 = dt << Subset(
Columns( cols_of_interest ),
Output Table Name( "Big Class 2" )
);
"
Thanks,
Simon