SAS datetime formatting as POSIX -


I should format the SAS in a POSIX format datetimes. In the following "2009-11-25 14:44:56" how can I show milliseconds?

  proc format; Picture POSIX other = '% 0Y-% 0m-% 0d% 0H:% 0M:% 0S' (datatype = datetime); Run; Data testing; Mydatetime = '25nov2009 14: 44: 56.300 DD; Format newdt POSIX.; Newdt = mydatetime; Mydatetime = newdt =; Run;   

Edit: I'm not taking any method to format data format to YYYY-MM-DD HH: M: SS.sss (ISO8601) Find it in less than 1 minute

E8601DT23.3 should show its values, additional " T "separator; SAS requires that if you are putting on the value of a character, you can easily remove "T"; If you are trying to use a formatted numeric value, then I think you have to be with it.

  data testing; Mydatetime = '25nov2009 14: 44: 56.356 DD; Format newdt E8601DT23.3; Newdt = mydatetime; Mydatetime = newdt =; Run;   

SAS guide on ISO8601:

EDIT: SAS-L has arrived at (). If you have 9.3, then it should work (not 9.2 or earlier).

  proc format; Picture POSIX other = '% 0Y-% 0m-% 0d% 0H:% 0M:% 0s' (data type = date time); Run; Data testing; Mydatetime = '25nov2009 14: 44: 56.300 DD; Format newdt POSIX23.3; Newdt = mydatetime; Mydatetime = newdt =; Run;   

Please include the Little S, and Decimal, and it should work as expected thanks to the Empty data for the tip.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -