BookmarkSubscribeRSS Feed
5062917
Calcite | Level 5

Hi,

I have a dataset where dates are stored as a character in the format, MMM DD YYYY, 00:00, e.g."Jun 26 2015, 08:38" or "Apr 9 2015, 20:15". Is there any way to turn this into a numeric date?

 

 

Thanks in advance 🙂 

2 REPLIES 2
novinosrin
Tourmaline | Level 20
data have;
k="Apr 9 2015, 20:15  ";
output;
k="Jun 26 2015, 08:38";
output;
run;
data want;
set have;
k1=input(k,anydtdtm21.);
format k1 datetime20.;
run;
ballardw
Super User

@5062917 wrote:

Hi,

I have a dataset where dates are stored as a character in the format, MMM DD YYYY, 00:00, e.g."Jun 26 2015, 08:38" or "Apr 9 2015, 20:15". Is there any way to turn this into a numeric date?

 

 

Thanks in advance 🙂 


Date (day information only) or datetime which includes the time portion? SAS does treat those differently and is important to be precise.

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1319 views
  • 0 likes
  • 3 in conversation