Hello -
I'm trying to create a macro variable to read in the input file name and then passing that variable to an infile statement in which I have single quotes. I'm using sas to open the excel file. When I use the put statement to display the macro variable value it shows fine, but when I use it inside a datastep I get error message. Here's the code and the error message. Thanks!
%let inputfiles=F:\Store Risk Model\ABC\2009\Period_03\InputFiles;
%let in_filename=LOCN Extract - Latest Update.xls;
options noxwait noxsync;
x '"C:\Program Files\Microsoft Office\Office10\excel.exe"';
data _null_;
x=sleep(2);
run;
filename ddecmd dde 'excel|system';
data _null_;
file ddecmd;
put %BQUOTE(')[FILE-OPEN("&inputfiles.\&in_filename.")]%BQUOTE(');
run;
%put %BQUOTE(')[FILE-OPEN("&inputfiles.\&in_filename.")]%BQUOTE(');
The get the following error:
30 data _null_;
31 file ddecmd;
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE and COLUMN where the error has
occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, arrayname, #, (, +, /, //, ;, @, @@,
OVERPRINT, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_.
32 put %BQUOTE(')[FILE-OPEN("&inputfiles.\&in_filename.")]%BQUOTE(');
-
200
ERROR: Undeclared array referenced: NAME.
ERROR 200-322: The symbol is not recognized and will be ignored.
22: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL may allow recovery of the LINE and COLUMN where the error has
occurred.
ERROR 22-322: Syntax error, expecting one of the following: a name, an integer constant, arrayname, #, $, &, (, +, /, //, :,
;, =, ?, @, @@, OVERPRINT, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_, ~.
32 put %BQUOTE(')[FILE-OPEN("&inputfiles.\&in_filename.")]%BQUOTE(');
-
200
ERROR 200-322: The symbol is not recognized and will be ignored.
33 run;