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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -