data _null_;,
After having made some changes (related to the SAS version that we use at the customer), I've tried to execute your example but it gives the following error.
Would it be possible that I have this error message because of the SAS version ? What could I use in order to get the same result ? Could you briefly explain me the aim of that 'pipe' option (I'm not used to such customization of the infile statement) ?
PeterC,
I've tried with other variants of the dbms option but this does not change anything.
I still have an error message in the logfile if the sheet that I try to import does not exist in the Excel file.
Thanks to both of you for your time.
Kind Regards,
Florent
441 filename workbook "...\SCEN_PTC01_090611-1710_0714-1424.xls";
442 data work.sheets;
443 length path script filevar command $256;
444 path = pathname('WORKBOOK');
445 script = pathname('WORK')||'\SHEETNAMESS.vbs';
446 filevar = script;
447
448 /* write the script */
449 file dummy1 filevar=filevar;
450
451 put 'Const ' path=:$quote256.;
452 put 'Set objExcel = CreateObject("Excel.Application")';
453 put 'With objExcel';
454 put +3 '.Visible = False';
455 put +3 '.DisplayAlerts = False';
456 put +3 'Set objWorkbook = .Workbooks.Open(path)';
457 put +3 'Set colSheets = .Worksheets';
458 put +3 'For Each objSheet In colSheets';
459 put +6 'WScript.echo objsheet.name';
460 put +6 'Next';
461 put +3 '.Application.Quit';
462 put +3 'End With';
463
464 /* close the script file by opening another, not used */
465 filevar = pathname('WORK')||'DUMMY.vbs';
466 file dummy1 filevar=filevar;
467
468 /* look at the script, not necessary but may be useful */
469 infile dummy2 filevar=script end=eof;
470 do _n_ = 1 by 1 until(eof);
471 input;
472 put _n_ z3. +1 _infile_;
473 end;
474
475 /* call the script */
476 command = 'cscript //nologo '||quote(trimn(left(script)));
NOTE: SCL source line.
477 infile dummy3 pipe filevar=command end=eof length=l;
----
23
ERROR 23-2: Invalid option name PIPE.
478 do until(eof);
479 input sheet $varying256. l;
480 output;
481 put _infile_;
482 end;
483 stop;
484 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.SHEETS may be incomplete. When this step was stopped there were 0 observations and 2 variables.
WARNING: Data set WORK.SHEETS was not replaced because this step was stopped.
NOTE: DATA statement used:
real time 0.01 seconds
cpu time 0.01 seconds
... View more