05-09-2016 06:02 PM - edited 05-10-2016 09:53 AM
I had to switch servers I was using at work, and the new one "doesn't have SAS/CONNECT spawner running on it" per our SAS administrator. so now i cannot use an old code that had "pipe" in it to import a whole bunch of excel files in one swoop. they don't have to be appended, but i would like each one saved as it's own dataset. is there anyway to do this WITHOUT using "pipe"? everything i've looked for online doesn't have the output i want as an option. i'm using SAS EG 6.1 (64 bit)
old code below
filename indata pipe 'dir C:\Users\engacr\Documents\"My SAS Files"\9.4\200k_Cars\2015_Q1 /b ';
data file_list; length fname $90 in_name out_name $50; infile indata truncover; input fname $ 90.; in_name=translate(scan(fname,1,'.'),'_','-'); out_name=cats('TEMP_',in_name); if upcase(scan(fname,-1,'.'))='XLSX'; run;
data _null_; set file_list end=last; call symputx(cats('dsn',_n_),in_name); call symputx(cats('outdsn',_n_),out_name); if last then call symputx('n',_n_); run; %macro test; %do i=1 %to &n; PROC IMPORT OUT= work.&&outdsn&i. DATAFILE= "C:\Users\engacr\Documents\My SAS Files\9.4\200k_Cars\2015_Q1\&&dsn&i...xlsx" DBMS=EXCEL REPLACE; GETNAMES=YES; MIXED=YES; SCANTEXT=YES; USEDATE=YES; SCANTIME=YES; DBDSOPTS= "DBTYPE=(pct_load='NUM(8)')"; RUN; %end; %mend; %test data work.combined; length veh_type_um $20.; set TEMP_:; run;
excel files in folder:
and so forth
would like them to output as:
and can append them if necessary
05-09-2016 07:25 PM
So the pipe command is used to create the list of files that are to be imported. If you don't have pipe you'll have to find another way.
It seems that you can use filename functions for this, but I can't find a good reference.
Here's one example:
05-10-2016 05:58 AM
Filename pipe is not a feature of CONNECT, it is in base SAS.
If you are using a workspace server, XCMD needs to be enabled in the server definition in the metadata.
05-10-2016 12:05 PM
I'm using SAS EG 6.1 (64 bit)
Which is not really important in this context. Location and definition of the workspace server is important.
Have you already tried to run your code, and what were the results (log) if you did?