BookmarkSubscribeRSS Feed
bobbyc
Fluorite | Level 6

 

How do I convert   05AUG16:17:10:05   to  2016-08-05T17:10:05  ?

 

 

Thanks for your help.

2 REPLIES 2
Michiel
Fluorite | Level 6

data _NULL_;
format
dt datetime20.
dt2 E8601DT20.
;
dt=datetime();
dt2=dt;
put dt= dt2=;
txt=put(dt,datetime20.);
txt2=put(dt2,E8601DT20.);
put txt= txt2=;
run;

 

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm

 

DrAbhijeetSafai
Lapis Lazuli | Level 10

I found the reply helpful, but it is difficult to read the answer in current alignment. Hence, I am wring the same answer with proper alignment.

=================================================================================

data _NULL_;
          format dt datetime20. dt2 E8601DT20. ;
          dt=datetime();
          dt2=dt;
          put dt= dt2=;
          txt=put(dt,datetime20.);
          txt2=put(dt2,E8601DT20.);
          put txt= txt2=;
run;

 

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm

 

================================================================================

Thanking you,

Yours sincerely,

 

- Dr. Abhijeet Safai

 

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real

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!

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
  • 2 replies
  • 4995 views
  • 3 likes
  • 3 in conversation