cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
mikedriscoll
Level VI

Select Where() not working

I spent a lot of time trying to create a simple "Select Where()" statement in JMP, and it was not working.

Here's the line of code I was trying to use:

dtData << select where(yParamList <= minLimList);

yParamList is a valid column

minLimList is a valid number

After reading some of these forums, I found someone suggesting to put it all in a string and then parse it out, so i changed the above code to this:

select_string = "dt << select where(" || ":" || yParamNames || " < " || char(minLimList) || ");";
eval(parse(select_string));

yParamNames is just a name version of the yParamList from the original code.

My question is, why doesn't my original code work? 

Here's the link where it was suggested to use the string, and eval(parse(string));

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Select Where() not working

Try to enclose yParamList within As Column().

This works in JMP 10:

dtData = Open( "$SAMPLE_DATA/Big Class.jmp" );

yParamList=dtData<<get column names;

minLimList={12,14};

i=2;

dtData << select where(as column(yParamList[i]) <= minLimList[i]);

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Select Where() not working

Try to enclose yParamList within As Column().

This works in JMP 10:

dtData = Open( "$SAMPLE_DATA/Big Class.jmp" );

yParamList=dtData<<get column names;

minLimList={12,14};

i=2;

dtData << select where(as column(yParamList[i]) <= minLimList[i]);

mikedriscoll
Level VI

Re: Select Where() not working

Thanks. That was driving me crazy.  I looked at the As Column() function but didn't bother because I can't believe JMP isn't smart enough to know it is column.  At one point I had a column(dtData, yParamList) statement in there as well.

The thing is, after I plugged your code in there, it took about 15 seconds for the script to run through my loop of about 420 columns x 4000 rows. I thought that was strange because it had just run in about 2 seconds with the string / parse method that I had used as a work around. Seems like the string / parse method is actually much more efficient... go figure.