How can I easily retrieve the column "position" in a large table?Hello JMP Community,
While writing quick and simple scripts with For loops, I usually enter the starting and ending columns manually (i.e. For i=start, i <=end, i++) to allow for the analysis of different ranges of variables.
Is there a simple way to retrieve the position of a given column to use as either starting or ending column? I use the rather awkward method of selecting all columns up to the desired column but it seems highly inefficient. Another method I have used is to create a new table where the column names are stacked in rows and use the row numbers as positions.
I assume that there is a simpler method that has escaped me so far.
Thank you for your help.
Re: How can I easily retrieve the column "position" in a large table?I'd forgotten about the "string" argument!
Re: How can I easily retrieve the column "position" in a large table?Try this:
dt=open("$sample_data/big class.jmp");
lookup=associativearray((dt<<GETCOLUMNREFERENCE></GETCOLUMNREFERENCE>
lookup["age"] = 2;
lookup["height"] = 4;
The associative array must be rebuilt if the columns are moved/deleted/added in the table. dt<
There is also a dt<Re: How can I easily retrieve the column "position" in a large table?
What I use is:
position=Loc(dt<<GET column="" names=""></GET>