cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
markschahl
Level V

Select rows #x to #y in a table

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
peterw
Level II

Re: Select rows #x to #y in a table

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

3731_jmp-pic.jpg

View solution in original post

4 REPLIES 4
peterw
Level II

Re: Select rows #x to #y in a table

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

3731_jmp-pic.jpg

pmroz
Super User

Re: Select rows #x to #y in a table

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);


mtl
mtl
Level I

Re: Select rows #x to #y in a table

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

paramaribo
Level I

Re: Select rows #x to #y in a table

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;