sas - Using macro in proc sql with ODBC connection to Access database -
i have macro variable called filename. tried use in proc sql connects access databse through odbc. however, code have either has error or not recognizing macro variable.
here code:
%let filename=myfile.name proc sql; connect odbc ("dsn=ms access database;"|| "dbq=&dbname;"|| "fil=ms access;" || "maxbuffersize=512;" || "pagetimeout=600;" || "uid=admin"); create table t1 select * connection odbc (select * tablea filename='&filename'); quit;
this returns 0 row. if replace macro variable real value in query, return 1 row correct data.
if use double quotation around &filename, following error: error: cli describe error: [microsoft][odbc microsoft access driver] '' not valid name. make sure not include invalid characters or punctuation , not long.
could tell me how should pass macro variable query? thanks.
you need make sure if want resolve macro variable, isn't wrapped within single quotes. line:
where filename='&filename');
...needs be:
where filename="&filename");
Comments
Post a Comment