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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 822 views
  • 0 likes
  • 2 in conversation