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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 679 views
  • 0 likes
  • 4 in conversation