BookmarkSubscribeRSS Feed
KevinC_
Fluorite | Level 6
Hello everyone,

Does anyone know how to convert a DB2 timestamp value from this:

15JUL1992:14:15:44.00208

to something like this?
1992-07-15:14:15:44.00208

I really appreciate your help!
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
From the SAS support http://support.sas.com/, using SEARCH facility:

Usage Note 8510: PROC FORMAT with PICTURE statement gives flexibility for DATE, TIME and DATETIME FORMATS

http://support.sas.com/kb/8/510.html


Scott Barry
SBBWorks, Inc.
KevinC_
Fluorite | Level 6
Hi Scott,

Thank you so much for the input! I got this instruction from the link you provided:

proc format;
picture dttime other='%0m/%0d/%0y %0H:%0M:%0S'
(datatype=datetime);
run;

It has worked for the most part. But the problem now is the milisecond (in bold print) at the end has been truncated:
This is the data before:
15JUL1992:14:15:44.002087

This is the data after:
1992-07-15-14.15.44

Is there a milisecond symbol I can use in this case?

Thank you !!
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
I don't believe there is support beyond the second. If you are printing this information, it is possible to use the format in a DATA step PUT function assignment (to generate the date portion) and then concatenate the date with a SAS time-portion variable using the TIME format.

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 682 views
  • 0 likes
  • 2 in conversation