Whenever you have errors in the log, please show us the ENTIRE log for this code. We need to see the ENTIRE log, every single line, every single character, with nothing removed. Please copy the log as text, and paste it into the window that appears when you click on the </> icon.
First, make up your mind if you want to work with dates or datetimes. Date literals use the format
"ddmonyyyy"d
without a time component.
Next, the DAY interval in INTNX with an offset of 0 will simply return the input date value, so the whole function call is useless.
Next, your code contains multiple "curly" quotes, which are not valid, neither in SAS nor in Oracle. I suspect this happens because you edited code at some time in a word processor instead of a text editor, which is a BAD THING. Never do that.
Next, the SAS macro engine will not resolve macro variables inside single quotes.
Finally, Oracle will not recognize dates in DATE9. format. Database engines usually work with dates formatted as YYYY-MM-DD; I have never seen the ddmonyyyy format outside of SAS.
Hint:
First, get your pass-through query to run in the Oracle client. You will then know which code you need to send from SAS. Then, get it to work from within SAS without macro variables. Only then start to make it dynamic.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.