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
- :
- Re: Formula usage: How to create second column based on retained values from fir...

- Start Article
- 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

Nov 21, 2013 1:33 AM
(4977 views)

Hi, a recurring tasks can be seen in the attached JMP data table example. A first column has row values, that need to be continued for more rows than where the first column has the value. In thye example the first column has the numbers 1, 2, 3 etc mixed with letters (or any other irrevelant information). Now, the value of the second column should always be equal to the *last* value encountered in the first column. When a new *number* is seen in the first column, *that* value should be continued. Sounds complicated, but looks simpler in the table.

Any help appreciated. (In base SAS retain would do the job.)

Regards

Poul

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

If you need a formula column, I think this will work (assumes first row in Column 1 is a number):

New Column**(** "test",

Numeric,

Continuous,

Formula**(**

If**(** Is Missing**(** Num**(** :Column 1 **)** **)**,

Lag**(** :test, **1** **)**,

Num**(** :Column 1 **)**

**)**

**)**

**)**;

1 REPLY 1

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

If you need a formula column, I think this will work (assumes first row in Column 1 is a number):

New Column**(** "test",

Numeric,

Continuous,

Formula**(**

If**(** Is Missing**(** Num**(** :Column 1 **)** **)**,

Lag**(** :test, **1** **)**,

Num**(** :Column 1 **)**

**)**

**)**

**)**;