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
- :
- calulating number of days using JSL

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

Highlighted

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

Aug 21, 2012 6:22 AM
(3234 views)

hi all

iam trying to calculate the difference between tow days using JSL..i have a script where I extract rows from an excel sheet that has the column value 0. After extracting the required rows, I want to calculate the differnce between tow dates and place the value in a new column. my script goes like this:

dt = data table("Final Sheet");

match_rows = dt << get rows where( :Column Type == 0 );

dt << subset(columns(), rows(match_rows));

Output Table("DateSheet");

can some one help me how I can add a column in the final output sheet and then calcuate the difference between the tow dates which are in columns E and C.

I thank all the JMP users for helping me out in JSL scripting..iam very new to JSL.

1 ACCEPTED SOLUTION

Accepted Solutions

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

In JMP, help>books>scripting guide. Either search for "new column" or navigate the second of the 2 indexes to N and from there to "new column". You will see some examples of creating a new column in JSL which contains a formula. Since JMP dates are in seconds from 1/1/1904, the difference between two dates is in seconds. Divide by 60 to get the number of minutes, 60*60 for the number of hours, or divide by 60*60*24 to get the number of days.

new column("Duration in Days", Formula((:E-:C)/(60*60*24)))

1 REPLY 1

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

In JMP, help>books>scripting guide. Either search for "new column" or navigate the second of the 2 indexes to N and from there to "new column". You will see some examples of creating a new column in JSL which contains a formula. Since JMP dates are in seconds from 1/1/1904, the difference between two dates is in seconds. Divide by 60 to get the number of minutes, 60*60 for the number of hours, or divide by 60*60*24 to get the number of days.

new column("Duration in Days", Formula((:E-:C)/(60*60*24)))