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
- :
- Select rows #x to #y in a table

Topic Options

- 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

Jun 20, 2013 7:24 AM
(2048 views)

A colleague that is a new JMP user came to me with the following question:

"How to select a given range of rows in a data table?"

Example: I want to select rows 10000-35000.

We searched through the help, manuals, and I searched jmp.com and this forum. Could not find the answer. With a large data table, you can't easily select the first row and then scroll to the last desired row.

Thanks!

,Afterthought to the developers: if this can't be done, how about adding row number to the Data Filter dialog or Select By Row Number to Row Selection?

1 ACCEPTED SOLUTION

Accepted Solutions

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

Jun 20, 2013 8:17 AM
(3478 views)

Solution

You can add another column, and add a formula with the function "row()" - then you can use the Data Filter in the Rows menu item to select the rows you want. See screenshot below

4 REPLIES

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

Jun 20, 2013 8:17 AM
(3479 views)

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

Jun 20, 2013 8:23 AM
(1739 views)

You can also use a JSL script to do this:

dt = open**(**"$sample_data\Big Class.jmp"**)**;

select_matrix =index**(20**,**35)**;

dt << select rows**(**select_matrix**)**;

Change **dt** to point to your table, and change the rows mentioned in the call to **index** to the rows you desire. E.g. for your situation you would say:

dt = open**(**"your table here"**)**;

select_matrix =index**(10000**,**35000)**;

dt << select rows**(**select_matrix**)**;

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

Jun 20, 2013 8:33 AM
(1739 views)

One possible method, at least in the BASE SAS world, would be like below. Don't know if it directly applies to your case in JMP:

242 data a;

243 do i=1 to 10;

244 row=i;

245 output;

246 end;

247 run;

NOTE: The data set WORK.A has 10 observations and 2 variables.

NOTE: DATA statement used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

248

249 proc sql noprint;

250 create table b as

251 select *, monotonic() as rownum

252 from a

253 where monotonic()<=7 and monotonic()>=4;

NOTE: Table WORK.B created, with 4 rows and 3 columns.

254 quit;

NOTE: PROCEDURE SQL used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

255

256 data _null_;

257 set b;

258 put row=;

259 run;

row=4

row=5

row=6

row=7

NOTE: There were 4 observations read from the data set WORK.B.

NOTE: DATA statement used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

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

Jun 20, 2013 10:44 AM
(1739 views)

At least in Base SAS you can do this below. Just not sure in JPM.

Here is an example code:

Data subset_of_cars;

row_no +1; /* Just for demo/checking purpose*/

set sashelp.cars;

**if _n_ >= 100 and _n_ <= 200;**

run;