Subscribe Bookmark RSS Feed

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

jump

Community Trekker

Joined:

Sep 13, 2014

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
Solution

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

-Jeff
2 REPLIES
Solution

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

-Jeff
jump

Community Trekker

Joined:

Sep 13, 2014

Yes, thanks you. will try that.