BookmarkSubscribeRSS Feed
madhu
Calcite | Level 5
********Sorry, Please Ignore This**************


Hi everyone,

I am trying to write a code to seperate records with overlapping dates. But I have datetime in iso format (2009-10-09T10:00). I seperated the date and time an concatenated them into a different character variable(09OCT2009:10:00). How do I convert this into a numeric variable where I can use operators such as less than and Greater than.

Thanks Message was edited by: madhu
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
To change a character variable to a numeric variable, you can use the INPUT function. Since your character variable represents a date/time, you can use a date/time INFORMAT with the INPUT function to create a numeric variable that represents the number of seconds since midnight Jan 1, 1960.

There have been many previous posts in this forum and others on how to convert character date variables to numeric variables. If you either look in the documentation on INPUT and INFORMAT or search the forum postings, you should find some useful examples.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 1057 views
  • 0 likes
  • 2 in conversation