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
- :
- Discussions
- :
- Accumulate column data

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

Accumulate column data

Mar 17, 2009 12:14 PM
(1444 views)

How do I use the lag operator to add up data on a row wise basis? That is, I want to accumulate data from column tair in a new column called chilling degree if the tair value is > 5.

tair chilling degree

5 5

7 5

5 10

tair chilling degree

5 5

7 5

5 10

2 REPLIES

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

Re: Accumulate column data

I don't know the answer to this question, but it sounds like you're working with building energy data. Am I right? That's my field as well so I'd be happy to trade scripts and files with you.

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

Re: Accumulate column data

If you want to simply accumulate values in a column, you don't necessarily need the lag operator. If you want to accumulate data (get a cumulative sum) for a column called "tair", do the following:

1. Create a new column. In this example, I call it "total".

2. Put the following formula in the new column:

(ignore this line)

The formula takes the value of tair in the current row, and adds it to the previous value of total, thus creating a cumulative sum.

If you only want to accumulate the values if they are greater than or equal to 5, then use the formula:

(ignore this line)

The formula looks at the current value of tair, and if it is less than 5, instead of adding tair, it adds 0.

1. Create a new column. In this example, I call it "total".

2. Put the following formula in the new column:

(ignore this line)

The formula takes the value of tair in the current row, and adds it to the previous value of total, thus creating a cumulative sum.

If you only want to accumulate the values if they are greater than or equal to 5, then use the formula:

(ignore this line)

The formula looks at the current value of tair, and if it is less than 5, instead of adding tair, it adds 0.