Hi,
I encounter a problem when querying a data range in SQL server, when the comparison is less than a 'date', it went wrong. However, when a date is equal to a 'date' it works.
the blow query has an error;
proc sql noprint;
connect to sqlver as myserver (darasrc="share_data" authdomain="nopassword");
create table class_schedule as sellect * from connect to myserver
(select * from table_classA where class_date <'01NOV2022');
disconnect from sqltgt;
quit;
the blow query has no errors;
proc sql noprint;
connect to sqlver as myserver (darasrc="share_data" authdomain="nopassword");
create table class_schedule as sellect * from connect to myserver
(select * from table_classA where class_date ='01NOV2022');
disconnect from sqltgt;
quit;
But, I am interested in selecting the data less than a date, I need to use the "<" sign. How can I achieve that?
Kindly help.
Thank you!
I guess that SQL Server does not like the SAS date literal notation when the "smaller as" operator is used.
I found the problem. Thanks, pls ignore.
I guess that SQL Server does not like the SAS date literal notation when the "smaller as" operator is used.
Thank you @Kurt_Bremser
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.