SAS datetime formatting as POSIX -


i want sas format datetimes in posix format. following gives "2009-11-25 14:44:56" how can display milliseconds ?

proc format;     picture posix other='%0y-%0m-%0d %0h:%0m:%0s' (datatype=datetime); run; data test;   mydatetime='25nov2009 14:44:56.300'dt;   format newdt posix.;   newdt=mydatetime;   put mydatetime= newdt=; run; 

edit : taker of way format datetimes yyyy-mm-dd hh:m:ss.sss (iso8601) amazing can't find in less 1 minute

e8601dt23.3 should display values wish, except "t" separator; sas seems require that. if you're putting character value can remove "t" easily; if trying use formatted numeric value, think have live it.

data test;   mydatetime='25nov2009 14:44:56.356'dt;   format newdt e8601dt23.3;   newdt=mydatetime;   put mydatetime= newdt=; run; 

sas guide on iso8601:

http://support.sas.com/documentation/cdl/en/lrdict/64316/html/default/viewer.htm#a003169814.htm

edit: sas-l came through on 1 ( http://listserv.uga.edu/cgi-bin/wa?a1=ind1303c&l=sas-l#8 ). if have 9.3 should work (not in 9.2 or earlier).

proc format;     picture posix other='%0y-%0m-%0d %0h:%0m:%0s' (datatype=datetime); run; data test;   mydatetime='25nov2009 14:44:56.300'dt;   format newdt posix23.3;   newdt=mydatetime;   put mydatetime= newdt=; run; 

little s, , include decimal, , should work expected. data null tip.


Comments