BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Citrine10
Obsidian | Level 7

Hi

 

I need help with converting datetime20. to a character.

The format of the data is as follows:

18AUG2022:13:41:10

 

I need to convert it to character because I am concatenating this field with another character field. 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
data test;
   dt  = '18AUG2022:13:41:10'dt;
   cdt = put(dt, datetime20.);
   format dt datetime20.;
run;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20
data test;
   dt  = '18AUG2022:13:41:10'dt;
   cdt = put(dt, datetime20.);
   format dt datetime20.;
run;
Tom
Super User Tom
Super User

@Citrine10 wrote:

Hi

 

I need help with converting datetime20. to a character.

The format of the data is as follows:

18AUG2022:13:41:10

 

I need to convert it to character because I am concatenating this field with another character field. 


In that case you probably do not want to use DATETIME format.  Instead use something like E8601DT19. that will generate a string that will sort in chronological order.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1597 views
  • 0 likes
  • 4 in conversation