Hi All, I would like to use a SAS variable in my proc SQL's from statement, in order to create a dynamic query to automate monthly data requests. I would like to retrieve a table from a server, from a specific folder. Lets call the folder "MyFolder". There are monthly data table uploads to this folder, using a time stamp like yyyymmdd, where dd is the last day of the previous month. I would like my code, to always get the right date, without any extra manual work, and retrieve the appropriate table. %let TableDate = substr(put(intnx('month',intnx('month',&TodaysDate.,-1),0,'E'),yymmddn8.),3,6); PROC SQL; CREATE TABLE WORK.RandomName AS SELECT DISTINCT ID FROM MyFolder.Table &TableDate. _I WHERE ID = '12345678' AND CategoryID NOT IN ('45678','123789'); QUIT; I checked, and the TableDate returns the value I would expect it to return, the issue is, that when I try to use it in the from statement, for some reason it does not seem to translate? (Returns the code inside the variable instead of the value I desire). May I request Your kind help on this topic? I have been trying to resolve this issue for more time than I would like to admit, researched the forum, but could not find anything that would help me out. Thanks in advance! 🙂
... View more