Turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- How do get the position by fuzzy matching?

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

Highlighted

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

Jan 8, 2020 3:15 AM
(836 views)

```
dt=Open("$SAMPLE_DATA\Big Class.jmp");
dt<<Sort(By(4),Order(Ascending),replace table);
```

In ascending order of height, how do I get the row number of a value that does not appear in the height column that is closest to the height less than this value in the height column?

For example, this value is 54.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

This might work, but LocSorted has some edge cases, especially at the lower end, that might make it hard to use. Read the doc and decide what you need to do for the too-small and too-big case. I *think* it might always return the first row of the set of values, but that isn't documented. @XanGregg

```
dt=Open("$SAMPLE_DATA\Big Class.jmp");
dt<<Sort(By(4),Order(Ascending),replace table);
vector = dt:height<<getasmatrix;
position = loc sorted(vector,[54])[1];
show(dt[position,0]);
```

**dt[position,0] = {"LILLIE", 12, "F", 52, 64};**

Craige

- Tags:
- Loc Sorted
- LocSorted

2 REPLIES 2

Highlighted

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

This might work, but LocSorted has some edge cases, especially at the lower end, that might make it hard to use. Read the doc and decide what you need to do for the too-small and too-big case. I *think* it might always return the first row of the set of values, but that isn't documented. @XanGregg

```
dt=Open("$SAMPLE_DATA\Big Class.jmp");
dt<<Sort(By(4),Order(Ascending),replace table);
vector = dt:height<<getasmatrix;
position = loc sorted(vector,[54])[1];
show(dt[position,0]);
```

**dt[position,0] = {"LILLIE", 12, "F", 52, 64};**

Craige

- Tags:
- Loc Sorted
- LocSorted

Highlighted
##

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

Re: How do get the position by fuzzy matching?

Craige is correct: if there is more than one matching value, the index of the first matching value is returned.

Article Labels

There are no labels assigned to this post.