以下の SQL パススルー コードでマクロ変数を使用する必要がありますが、エラーが発生し続け、修正方法がわかりません。
%let mon1 = 201209;
proc sql;
/*Connection String*/
connect to odbc as sqldata (noprompt="uid=dr;pwd=raven;dsn=FinanceDW;") ;
create table output1 as /*This will create a SAS data set*/
select * /*this will select all from the command below and insert into the SAS dataset*/
from connection to sqldata
( /*Insert SQL CODE below - it can only use SQL any SAS code will cause it to fail*/
select top 10 *
from "AUS_&mon1._FCM15.dbo.contract"
);/*End SQL code*/
disconnect from sqldata;/*Close connection*/
quit;
次に、次のエラーが表示されます (ログからの抜粋):
23 select top 10 *
24 from "AUS_&mon1._FCM15.dbo.contract"
25
26 );
ERROR: CLI describe error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'AUS_201209_FCM15.dbo.contract'. : [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s)
could not be prepared.
データを取得する必要がある実際のテーブルは AUS_201209_FCM15 と呼ばれているため、何が問題なのかわかりませんか?