Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Max() behavior - different from JMP 12 vs JMP 11?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 2, 2017 7:39 AM
(644 views)

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

4 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 2, 2017 7:58 AM
(640 views)

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

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 2, 2017 11:13 AM
(630 views)

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!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 2, 2017 3:24 PM
(615 views)

I took it apart in a different way:

```
lst = {"17WW01", "17WW02", "17WW03", "17WW04", "17WW05"};
Max(lst);
```

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.

-Dave

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 2, 2017 12:45 PM
(620 views)

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