BookmarkSubscribeRSS Feed
mlogan
Lapis Lazuli | Level 10

Hi there,

I have the date time format as '1/11/2017 8:00:41 AM +00:00' and it is in character format. I don't there this '+00:00' came from, but in my all data they all end with '+00:00', so I really don't care.

can someone help me convert it to Datetime format like '1/11/2017 8:00:41 AM' please? 

 

DATA Have;
Date_Time='1/11/2017 8:00:41 AM +00:00';
RUN;

 

Thanks.

 

 

 

 

3 REPLIES 3
novinosrin
Tourmaline | Level 20

DATA Have;
Date_Time='1/11/2017 8:00:41 AM +00:00';
RUN;

data want;
 set have;
 want_date=input(date_time,mdyampm23.);
 format want_date  DATEAMPM. ;
run;
dennis_oz
Quartz | Level 8

@novinosrin @mlogan 

 

Hi I have a similar question . How to convert 28-APR-20 02.56.42.897749 PM   ( length is 28 char) to DATETIME ? Please can you help

novinosrin
Tourmaline | Level 20

Hi @dennis_oz  Would the below suffice?

data w;
 have='28-APR-20 02.56.42.897749 PM';
 want=input(have, datetime30.);
 format want datetime30.;
run;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 3113 views
  • 1 like
  • 3 in conversation