cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
shasha
Level I

Column name as variables

Hi there,

I have a question related to the column name convention.

For example, I have a table contains the ages of students from several grades.

age_grade1age_grade2age_grade3age_grade4age_grade5age_grade6age_grade7

I like to define a parameter, so I can use "for" loop to do some data processing.

1: only select the non-empty rows.

Parameter = "age_grade1" ;

dtRaw << Select Where( Is Missing( Parameter ) );

however, it won't do anything.

2. select students age in some range.

Parameter = "age_grade1";

dtRaw = select where (Parameter > 7);

it is not working either.

Please help me figure this out. What is the right syntax for the column name?

Thanks,

Shasha

1 REPLY 1
pmroz
Super User

Re: Column name as variables

You need to supply a column reference in this context.  Also don't use parameter as a variable name - that's a JSL function.  If the word(s) turn blue in the editor then it means that it's a function.

This code works.  Note the use of as column for the column reference.

dtraw = current data table();

col_name = "age_grade1" ;

dtRaw << Select Where( Is Missing( as column(dtraw, col_name) ) );

dtRaw << select where (as column(dtraw, col_name) > 7);