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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1326 views
  • 0 likes
  • 3 in conversation