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
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 721 views
  • 0 likes
  • 2 in conversation