- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.