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
- :
- long formula for a column in another file

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

May 11, 2015 11:33 AM
(1210 views)

Hi,

Is there any way to put a long formula for a column to another JSL file. My table has a column which has an about 1000 lines formula. I want to put this formula to another JSL file so that the main file will look like cleaner.

Thanks

3 REPLIES

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

May 11, 2015 12:19 PM
(1116 views)
| Posted in reply to message from huangshuojch 05/11/2015 02:33 PM

The way to add a column formula to a table using JSL is like this:

dt = open**(**"$sample_data\Big Class.jmp"**)**;

dt << **New Column(** "BMI", Numeric, Continuous, Format**(** "Fixed Dec", **12**, **2** **)**,

// Your formula goes here:

Formula**(** **((**:weight * **703)** / :height**)** / :height **)**

// end formula

**)**;

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

I'm re-reading your post. Perhaps you simply need the INCLUDE statement? Just put the statements to add the new column in another JSL file (called new_column.jsl for example). Then in your main program you would have this:

include**(**"c:\mydata\new_column.jsl"**)**;

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

May 11, 2015 12:32 PM
(1116 views)
| Posted in reply to message from huangshuojch 05/11/2015 02:33 PM

If there are multiple formula columns and some of the formula columns use other formula columns, JMP needs to see the relationships to determine which columns must evaluate first. If you move the formula out of the column, JMP will not get the evaluation order correct for columns that are dependent on other columns.

If you create a user defined function, AND you make sure it is defined ahead of time, you can call it from the column formula. This seems clumsy, maybe a better idea will pop up.

Craige