BookmarkSubscribeRSS Feed
goms
Fluorite | Level 6

 

Hi,

 

Below is my output

 

src_systimedate_systimelogtime
28APR2016:14:58:51.00000028apr1614:58:51
28APR2016:14:58:51.00000028apr1614:58:51
28APR2016:14:58:51.00000028apr1614:58:51
28APR2016:14:58:51.00000028apr1614:58:51
28APR2016:14:58:52.00000028apr1614:58:52
28APR2016:14:58:52.00000028apr1614:58:52

 

I want to convert the date format as below

 

 

src_systimedate_systimelogtime
2016-04-28 14:58:512016-04-2814:58:51
2016-04-28 14:58:512016-04-2814:58:51
2016-04-28 14:58:512016-04-2814:58:51
2016-04-28 14:58:512016-04-2814:58:51
2016-04-28 14:58:522016-04-2814:58:52
2016-04-28 14:58:522016-04-2814:58:52
5 REPLIES 5
Jagadishkatam
Amethyst | Level 16
data have;
input src_systime : anydtdtm20.	date_systime :date9.	logtime :time8.;
format src_systime  datetime20. 	date_systime date9. logtime time8.;
cards;
28APR2016:14:58:51.000000	28apr16	14:58:51
28APR2016:14:58:51.000000	28apr16	14:58:51
28APR2016:14:58:51.000000	28apr16	14:58:51
28APR2016:14:58:51.000000	28apr16	14:58:51
28APR2016:14:58:52.000000	28apr16	14:58:52
28APR2016:14:58:52.000000	28apr16	14:58:52
;
Thanks,
Jag
goms
Fluorite | Level 6

Its a SAS dataset only

Jagadishkatam
Amethyst | Level 16
Then, are these variables character type
Thanks,
Jag
Kurt_Bremser
Super User

If these are already SAS datetime, date and time values, you just need the proper formats.

Look at the E8601DT19. format for the datetime value, YYMMDDD10. for the date and TIME8. for the time.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 782 views
  • 1 like
  • 3 in conversation