cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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);

Recommended Articles