cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
jump
Level II

<< Get Values from a Column without subsetting each set of row selection.

So, I have a big dataset. Currently I am selecting few rows for each condition, subsetting the data and run  << get values (im My JSL script)  to move data to defined LIST.  This process is taking significant time, because as i mentioned dataset is huge.

I want to know, if there is a way to  << get values from a column for the selected rows without doing subset everytime. \

Or I have to subset every time to  << get values from  desired ROW\Column.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: << Get Values from a Column without subsetting each set of row selection.

You can get the value of a column for a given row by subscripting to that row.

 

For example:

 

dt=open("$SAMPLE_DATA\Big Class.jmp");
:name[1];

Will return "Katie" which is the name in the first row.

 

 

Likewise, you can use a matrix for the subscript.

 

dt=open("$SAMPLE_DATA\Big Class.jmp");
:name[[2,3,4]];

That returns: 

{"LOUISE", "JANE", "JACLYN"}

You can probably see where this is headed. The <<Get Selected Rows message returns a matrix, so you can use that to subscript directly to the column.

dt=open("$SAMPLE_DATA\Big Class.jmp");
rows=dt<<get selected rows;
:name[rows];

 

-Jeff

View solution in original post

2 REPLIES 2
Jeff_Perkinson
Community Manager Community Manager

Re: << Get Values from a Column without subsetting each set of row selection.

You can get the value of a column for a given row by subscripting to that row.

 

For example:

 

dt=open("$SAMPLE_DATA\Big Class.jmp");
:name[1];

Will return "Katie" which is the name in the first row.

 

 

Likewise, you can use a matrix for the subscript.

 

dt=open("$SAMPLE_DATA\Big Class.jmp");
:name[[2,3,4]];

That returns: 

{"LOUISE", "JANE", "JACLYN"}

You can probably see where this is headed. The <<Get Selected Rows message returns a matrix, so you can use that to subscript directly to the column.

dt=open("$SAMPLE_DATA\Big Class.jmp");
rows=dt<<get selected rows;
:name[rows];

 

-Jeff
jump
Level II

Re: << Get Values from a Column without subsetting each set of row selection.

Yes, thanks you. will try that.