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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 835 views
  • 0 likes
  • 4 in conversation