Subscribe Bookmark RSS Feed

How to convert character formats to date format

saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

Dear All,

I receive data in excel with Date columns in various format (defined as character)

31.02.2015

31.2.2015

Feb 31 2015

.

.

.

and many more..

Trying in excel to format them but does not work for excel import wizard (mac)

How will I convert them to one valid Date Column in JMP?

Thank you in advance for your support.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

perhaps this can work for you:

https://www.youtube.com/watch?v=9nRaDwsYB28

ron

10 REPLIES
saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

Any idea?

Solution

perhaps this can work for you:

https://www.youtube.com/watch?v=9nRaDwsYB28

ron

Steven_Moore

Super User

Joined:

Jun 4, 2014

I have also struggled with date formats importing to JMP.  What I do is this:  In Excel, I format my date column as "short date", i.e, 6/23/15.  Then, after importing the spreadsheet into a JMP data sheet, I then double click at the top of the date column and change the data type to Numeric and then change the modeling type to "Continuous".  Next click "Input Format" and click "Date" in the drop down menu.  You can then select the date format you wish to see in your JMP data table.

Steve
M_Anderson

Staff

Joined:

Nov 21, 2014

Try this out (see the formula column in the attached data table)...You can expand for the different date formats you encounter.

Best,

M

M_Anderson

Staff

Joined:

Nov 21, 2014

Looking at my example and ron_horne​'s example... they are basically the same concept... Use the informal() function.

The part that I didn't know, that the video indicates, is that if you leave out the second option of the informat() function, usually informal(<striing column>, <string format>), it will actually do that same thing as what I was proposing, but with a lot less coding. 


So, make a function in your data table that contains "Informat(<date column>)" and it should have you set.


Please be sure to mark ron_horne's answer as the correct one if that helps you out as it is the more elegant of the two solutions.


Best,


M

saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

Thank you for all the input!

After trying several weird character date formats imported as character through excel import wizard (mac), the informat function with deleting the secondary argument can handle most of the process (12 of 14 different char formats).

Once again many thanks to JMP community!

saitcopuroglu

Community Trekker

Joined:

Sep 29, 2014

One of the two char formats which informat function is unable to resolve is as screenshotted.

The function can resolve only the month of "May", I guess because it is the only 3 char month as its own and equals to abbreviated month char.

Recoding all months except May or Finding and Replacing all months to 3 char abbr. ones would be a solution of course but none of them would be that "elegant".

Any idea would be appreciated:

10204_Screen Shot 2015-10-15 at 16.20.07.png

M_Anderson

Staff

Joined:

Nov 21, 2014

Two options off the top of my head. Use the Recode Utility to change them all at once. Or you could use the nested Informat() arguments I proposed. You could build in a Match() argument into the logic to translate the long form month names into something JMP expects.

Best,

M

Sent from my iPhone

glenn_maxey0

Community Trekker

Joined:

Sep 23, 2015

I'm talking out of turn here. If this is a one-time conversion, then sometimes it is easier to write VBA macros to get the data in the source to conform to some standard before exporting and then importing into JMP. YMMV.