Subscribe Bookmark RSS Feed

Max() behavior - different from JMP 12 vs JMP 11?


Community Trekker


Jun 23, 2011

Why doesn't the following work in JMP 12 anymore?


Example, I have a column "WW" with entries like ("17WW01","17WW02","17WW03"..."17WW05").

And I want to find the latest workweek in the "WW" column (charcter/nominal in both JMP versions):

current_ww = Max(Associative Array(:WW << Get As Matrix()) << Get Keys);


JMP 11.1.1 => this works fine.  current_ww = "17WW05"

JMP 12.2.0 => this doesn't work anymore.  current_ww = .


Why is that?  Is Max() now super restrictive in JMP 12?   DJ


Super User


Jun 22, 2012

Apparently it has changed.  Neither JMP 12 or JMP 13 returns the same results as JMP 11.




Jun 23, 2011

I took it apart to see where it breaks down. I think that it is a bug. Here is the first part:

aa = Associative Array( :WW << Get As Matrix );
k = aa  << Get Keys;

This expression evaluates to:

Associative array( 5 elements ) assigned.
{"17WW01", "17WW02", "17WW03", "17WW04", "17WW05"}

Finally, I made a valid expression

max expr = Expr( Maximum() );
For( item = 1, item <= N Items( k ), item++,
	Insert Into( max expr, k[item] );
Show( Name Expr( max expr ) );

I get this result:

Name Expr(max expr) = Maximum("17WW01", "17WW02", "17WW03", "17WW04", "17WW05");

This is a valid call to the Maximum function. If the multiple arguments appear like this and not in a list or a matrix, then they must all be numeric or all character strings. Clearly this example meets the requirement. When I evaluate this expression, however, I get this result:

need arguments to be scalars, matrices, or lists in access or evaluation of 'Maximum' , Maximum/*###*/("17WW01", "17WW02", "17WW03", "17WW04", "17WW05")

If I try to use the original list of keys:

Name Expr(max expr) = Maximum({"17WW01", "17WW02", "17WW03", "17WW04", "17WW05"});

I don't get the error message. I get only the missing value as report in the original post.

Looks like a bug.

Learn it once, use it forever!

Super User


Jul 13, 2011

I took it apart in a different way:


lst = {"17WW01", "17WW02", "17WW03", "17WW04", "17WW05"};

This returns a value in JMP 11 but an empty value in 12 or 13.  I guess the workaround would be to sort the list and take the last item.  Not sure if the change of behaviour is a bug or a feature.




May 30, 2014

This was changed on purpose - Max() is a numeric function, like Mean() or Std Dev().


For strings, you can use Sort Ascending or Sort Descending. For example:


current_ww = Sort Descending(Associative Array(:WW << Get As Matrix()) << Get Keys)[1];