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

- JMP User Community
- :
- Discussions
- :
- How many ways to write JSL code for sum of the first five rows of a column in a ...

- 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

Aug 18, 2018 6:05 AM
(4919 views)

HLPE

For example, take Big Class. JMP as an example. First, the "age" of column 2 is sorted downward, and then the sum of the values of the first five rows of column 2 is calculated.How many ways can this be written in JSL code?Thank you very much!

The following code is incorrect:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

col = Column( dt, 2 );

dt << Select Where( col[] > 14 & row()<=5 );

n = Col Sum(col[],Selected());

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

try something like

sum(dt[ 1::5, 2 ] ) or sum(dt[1::5, "age" ] )

https://community.jmp.com/t5/Uncharted/Data-table-subscripting/ba-p/21013

Craige

2 REPLIES 2

Highlighted

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

try something like

sum(dt[ 1::5, 2 ] ) or sum(dt[1::5, "age" ] )

https://community.jmp.com/t5/Uncharted/Data-table-subscripting/ba-p/21013

Craige

Highlighted
##

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

Re: How many ways to write JSL code for sum of the first five rows of a column in a table?

Thank you very much! I have too little.

Article Labels

There are no labels assigned to this post.