Oleg,
Great macro.
It works fine in native SAS 9.2 but I get the following error messages when running it on Enterprise Guide 4.3:
ERROR: Insufficient authorization to access PIPE.
ERROR: Error in the FILENAME statement.
Any idea anyone what I can do to make it work in Enterprise Guide? Here is the modified macro code I am using:
%macro w2sas05(input=c:\Data\SAStests\ScrapTies\, out=work.DailyTemp);
* read files in directory ;
%let dir=%str(%'dir %")&input.%str(\%" /A-D/B/ON%');
filename myfiles pipe %unquote(&dir);
data list1;
length fname $256.;
infile myfiles truncover;
input myfiles $100.;
* put _infile_;
fname=quote(upcase(cats("&input",'\',myfiles)));
drop myfiles;
run;
filename myfiles clear;
%let j=1;
%let dsid=%sysfunc(open(list1));
%let rc=%sysfunc(fetch(&dsid));
%do %while(&rc=0);
%let file=%sysfunc(getvarc(&dsid,%sysfunc(varnum(&dsid,fname))));
PROC IMPORT DBMS=EXCEL OUT= _&j
DATAFILE= &file REPLACE ;
SHEET="summary";
GETNAMES=YES;
SCANTEXT=YES;
USEDATE=NO;
SCANTIME=NO;
DBSASLABEL=NONE;
TEXTSIZE=100;
RUN;
proc append force data=_&j base=&out;
run;
proc delete data=_&j;
run;
data &out;
set &out;
run;
%let rc=%sysfunc(fetch(&dsid));
%let j=%eval(&j+1);
%end;
%let rc=%sysfunc(close(&dsid));
%mend w2sas05;
%w2sas05;
... View more