cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
derchieh
Level II

referencing column using Column("name")

Hi,

I have a "quick" question:

dt = Open( "$Sample_data/Big Class.jmp" );

//// These don't work;
dt << Select where( Column("sex") == "F"); 
dt << Select where( Column(3) == "F");

//// Only this works...why?? dt << Select where (:sex == "F");

I am pretty sure all these options used to work for me.....has something changed? I am using JMP16.

Reason I am asking is because I usually have the column names in a list, then create iteration using For loop and Column(colname[i]) to point to the appropriate column. 

 

Any help will be much appreciated. Thank you.

Derchieh

2 ACCEPTED SOLUTIONS

Accepted Solutions
pmroz
Super User

Re: referencing column using Column("name")

This works:

dt = Open( "$Sample_data/Big Class.jmp" );

//// These work now;
dt << Select where( as Column("sex") == "F"); 
dt << Select where( as Column(3) == "F");
//// Only this works...why??
dt << Select where (:sex == "F");

In general, if column("col-name") doesn't work, try as column("col-name").

View solution in original post

txnelson
Super User

Re: referencing column using Column("name")

You need to use the As Column() function.  I tested the code back to JMP 11 and the Column() function did not work, only the As Column()

names default to here(1);
dt = Open( "$Sample_data/Big Class.jmp" );

//// These don't work;
dt << Select where( as Column("sex") == "F"); 
dt << Select where( as Column(3) == "F");
//// Only this works...why??
dt << Select where (:sex == "F");
Jim

View solution in original post

3 REPLIES 3
pmroz
Super User

Re: referencing column using Column("name")

This works:

dt = Open( "$Sample_data/Big Class.jmp" );

//// These work now;
dt << Select where( as Column("sex") == "F"); 
dt << Select where( as Column(3) == "F");
//// Only this works...why??
dt << Select where (:sex == "F");

In general, if column("col-name") doesn't work, try as column("col-name").

txnelson
Super User

Re: referencing column using Column("name")

You need to use the As Column() function.  I tested the code back to JMP 11 and the Column() function did not work, only the As Column()

names default to here(1);
dt = Open( "$Sample_data/Big Class.jmp" );

//// These don't work;
dt << Select where( as Column("sex") == "F"); 
dt << Select where( as Column(3) == "F");
//// Only this works...why??
dt << Select where (:sex == "F");
Jim
derchieh
Level II

Re: referencing column using Column("name")

Thanks heaps for checking....!