Hi,
Below is my output
| src_systime | date_systime | logtime |
| 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 |
I want to convert the date format as below
| src_systime | date_systime | logtime |
| 2016-04-28 14:58:51 | 2016-04-28 | 14:58:51 |
| 2016-04-28 14:58:51 | 2016-04-28 | 14:58:51 |
| 2016-04-28 14:58:51 | 2016-04-28 | 14:58:51 |
| 2016-04-28 14:58:51 | 2016-04-28 | 14:58:51 |
| 2016-04-28 14:58:52 | 2016-04-28 | 14:58:52 |
| 2016-04-28 14:58:52 | 2016-04-28 | 14:58:52 |
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
;
Is the "output" a text file or already a SAS dataset?
Its a SAS dataset only
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.