cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
dfusco923
Level III

How to calculate using JMP script "Mon-Day-Year Calculated" column from a character variable

I would like develop a JMP script to automatically calculate and populate the "Mon-Day-Year Calculated" column in the attached JMP database.  In the database I manually calculated and populated the "Mon-Day-Year Manually Calculated and Entered" column.  The "K9-MON_Year" character variable would be used to automatically calculate "Mon-Day-Year Calculated" data.  Please note that I would like all "Days" = 15 .  Also see the attached PowerPoint.  Thanks in advance!

Community MonDayYear.png

1 ACCEPTED SOLUTION

Accepted Solutions
Georg
Level VII

Re: How to calculate using JMP script "Mon-Day-Year Calculated" column from a character variable

I'm not sure whether I got you right, to calculate the date from the string I would use following formula:

Date DMY( 1, Num( Word( 2, :K9_MON_YEAR, "/" ) ), Num( Word( 3, :K9_MON_YEAR, "/" )

Here I placed a fixed Day=1 into the formula, I did'nt know where to get the information about day from. Maybe you can change according to your needs.

Georg

View solution in original post

4 REPLIES 4
Georg
Level VII

Re: How to calculate using JMP script "Mon-Day-Year Calculated" column from a character variable

I'm not sure whether I got you right, to calculate the date from the string I would use following formula:

Date DMY( 1, Num( Word( 2, :K9_MON_YEAR, "/" ) ), Num( Word( 3, :K9_MON_YEAR, "/" )

Here I placed a fixed Day=1 into the formula, I did'nt know where to get the information about day from. Maybe you can change according to your needs.

Georg
dfusco923
Level III

Re: How to calculate using JMP script "Mon-Day-Year Calculated" column from a character variable

Thanks Georg - This is very close to what I am looking for except I would like the format to be m/d/y. Also I would like the "d" value to be 15.

Can you recommend the JMP script for that?
txnelson
Super User

Re: How to calculate using JMP script "Mon-Day-Year Calculated" column from a character variable

All you need to do to change @Georg formula to output the 15th day instead of the 1st day, is to change the Day parameter passed to the Date DMY() function.  This would be the first parameter, as indicated in the name of the function.   As can be seen in @Georg formula, the value is "1".  Just change it to 15.

The changing of the display format to m/d/y, what needs to be done, is to go to the Column Info dialog box(right click on the column header and select Column Info), and in that dialog, change the format to the m/d/y format.

 

Documentation on JMP date time columns is covered in the JMP Document called Using JMP.  It can be found in the JMP Documentation Library, available under the Help pull down menu.

Jim
dfusco923
Level III

Re: How to calculate using JMP script "Mon-Day-Year Calculated" column from a character variable

Thanks for the help.