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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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