BookmarkSubscribeRSS Feed
lerdem
Quartz | Level 8

I need to compare 2 date :

One of them is in character value 20$ and looks "2016-04-01 14:30:29"

Other one is numeric datettime20. and looks "05AUG2002:09:15:55"

 

i will compare them, how can i convert it?

 

1 REPLY 1
ballardw
Super User

See if this approach works for you:

data junk;
   x="2016-04-01 14:30:29";
   y= dhms(input(scan(x,1,' '),yymmdd10.), 0,0,input(scan(x,2,' '),time.));
   format y datetime20.;
run;

Compare a variable make like Y to your other value.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 856 views
  • 0 likes
  • 2 in conversation