BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Kirito1
Quartz | Level 8

The below code is throwing an error as below:

Invalid date/time/datetime constant '01-09-2022:00:00:00am'dt.
proc sql;
create table dummy as 
Select * from MR
where 'Date Of approval'n GE '01-09-2022:00:00:00am'dt. AND 'Date Of approval'n LE '30-11-2022:00:00:00am'dt.;
quit;

 How should I proceed?

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

The date in a datetime literal must be written in the same DATE9. format like a date literal, e.g. '01jan1960:00:00:00'dt. Do not use am/pm, but 24-hour notation.

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

The date in a datetime literal must be written in the same DATE9. format like a date literal, e.g. '01jan1960:00:00:00'dt. Do not use am/pm, but 24-hour notation.

Kirito1
Quartz | Level 8
So, does that mean its a limitation for me as the data I have is in ddmmyy format. So, I first have to convert that data in date9 format in excel and then use it as my data.
That's really tedious.
BTW thanks for the solution kindly suggest if there are any other alternative.
Kurt_Bremser
Super User

If you have SAS datetime values, the display format is irrelevant, as the underlying raw values are counts of seconds, starting at 1960-01-01T00:00:00.

If you do not have SAS datetimes, but character strings, these must be converted first. This should be done when the data is imported into SAS.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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