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
Theresa
Level IV

Could you explain this usage? i don't clear why use informat when format the date

 

Confusion: 1. What's this sentence function mean? 2 What's the function of Informat() here? 

 

Column( dt, "TIME" ) << Data Type( Numeric, Informat( "y/m/d h:m:s", 0 ), Format( "y/m/d h:m:s", 22, 0 ) ) << Modeling Type( "Continuous" );

 

Suggestion:

If we want to format the date information, then just use "Format“ as our target form is more convenient for us in case we need take time to learn what's the input format. We always clear know the target form, So i don't know what's the benefit for use informat here or in sentence, hope can learn more and understand more.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Could you explain this usage? i don't clear why use informat when format the date

I'd guess the Time column starts out as character data. 

 

dt:Time << Data Type( Numeric, Format( "h:m", 12 ), Input Format( "h:m" ) )

The reason the (copied from scripting index...) <<DataType message takes additional parameters after Numeric vs Character is because converting a character column of dates to numeric needs the informat to get the right answer. So yes, you should provide both format and informat.

The same thing is true in the dialogs for converting a character column of dates to a numeric column of dates: if you don't supply the informat, the date strings get converted to missing values.

 

We are also guessing. If you copy the error message from the log we might guess better. As Jim hinted, we also don't know what the data type of your column is, before you try to change its type.

Craige

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Could you explain this usage? i don't clear why use informat when format the date

The informat simply is telling JMP, you interpret input into this column should be interpreted as "y/m/d h:m:s".  This may be more clear in the case where a user only wants to inter in something like month year data, but to have it displayed as m/d/y data.  One would then specify and informat("m.y") and a format("m/d/y").  This would make the input more efficient if one is counting key strokes.

Jim
Craige_Hales
Super User

Re: Could you explain this usage? i don't clear why use informat when format the date

Informat tells JMP how to interpret dates typed into a cell in the data table. Format tells JMP how to display the dates. Usually they match, or mostly match as in Jim's example. If you never edit the date, the informat won't be used.

Craige
Theresa
Level IV

Re: Could you explain this usage? i don't clear why use informat when format the date

Thanks for your reply.

I still have confusion on below points:
The final result which displayed out is control by Format(out put format) right? the input format is pulling the data from system then will follow put Format requirements change the format right? I don't know if it is this logic.

The first sentence could let the date format display as Format( "y/m/d h:m:s", 22, 0 ); How about the second sentence, is it correct or wrong? I mean i have no requirement on input format, i only want the output display follow my requirement, if the second one could realize this function?

1: Column( dt, "TIME" ) << Data Type( Numeric, Informat( "y/m/d h:m:s", 0 ), Format( "y/m/d h:m:s", 22, 0 ) ) << Modeling Type( "Continuous" );

2. Column( dt, "TIME" ) << Data Type( Numeric, Format( "y/m/d h:m:s", 22, 0 ) ) << Modeling Type( "Continuous" );-------------Is this sentence correct? I try it in script, it will pop up error, seems the input format must have.


txnelson
Super User

Re: Could you explain this usage? i don't clear why use informat when format the date

I have run the code you indicate is giving you an error.  It runs fine on JMP 15.1, pointing it to an already existing numeric column.  What are the attributes of your column Time?    Numeric? Character? Nominal, Ordinal or Continuous?  What does the current values display as?

Jim
Craige_Hales
Super User

Re: Could you explain this usage? i don't clear why use informat when format the date

I'd guess the Time column starts out as character data. 

 

dt:Time << Data Type( Numeric, Format( "h:m", 12 ), Input Format( "h:m" ) )

The reason the (copied from scripting index...) <<DataType message takes additional parameters after Numeric vs Character is because converting a character column of dates to numeric needs the informat to get the right answer. So yes, you should provide both format and informat.

The same thing is true in the dialogs for converting a character column of dates to a numeric column of dates: if you don't supply the informat, the date strings get converted to missing values.

 

We are also guessing. If you copy the error message from the log we might guess better. As Jim hinted, we also don't know what the data type of your column is, before you try to change its type.

Craige
Theresa
Level IV

Re: Could you explain this usage? i don't clear why use informat when format the date

Yes, the original data which was pulling out was Character type. I find the sentence in pulling data section" ,To_Char(a0.data_collection_time,'yyyy-mm-dd hh24:mi:ss') AS TIME"

Now i fully understand. informat and format function.If it is "numeric" type only use Format is enough. if it is other type like character, the much use Informat to do a type convert.

Thank you very much.