From: Bill McKirgan on 7 Sep 2006 11:29
I have a situation where I need to use DDE to open excel files prior to
running proc import to read data because the first line of data for the
8th column begins after line 800 (if the files are closed then column 8
I can open the excel files and read the data now using DDE, but I
cannot figure-out how to close the file I opened. I do not want to
save the file that was opened, or save as another file. I simply want
to close it after all 8 columns have been read by proc import.
Thanks in advance,
Here is my test code...
options noxwait noxsync;
PROC IMPORT OUT= WORK.TEST1dde
/* Quit Excel using DDE. */
file "c:\temp\excel_test.xls" ;
266 options noxwait noxsync;
267 x 'c:\temp\excel_test.xls'
267! ; /* you might need to specify */
268 /* the complete pathname */
272 PROC IMPORT OUT= WORK.TEST1dde
273 DATAFILE= "c:\temp\excel_test.xls"
274 DBMS=EXCEL REPLACE;
SYMBOLGEN: Macro variable _IMEXSERROR_ resolves to SERROR
NOTE: WORK.TEST1DDE was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 1.09 seconds
cpu time 0.34 seconds
282 data _null_;
283 file "c:\temp\excel_test.xls" ;
284 put "[quit()]";
ERROR: File is in use, c:\temp\excel_test.xls.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds