Subscribe Bookmark RSS Feed

Select Where() not working

mikedriscoll

Community Trekker

Joined:

Jun 23, 2011

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
Solution

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]);

2 REPLIES
Solution

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

Community Trekker

Joined:

Jun 23, 2011

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.