Hi All, I have to import numerous files into SAS on multiple times during the month. I would really like to automate this process, but to date have failed to do so. I have to work in a SAS EG 5.1 server environment, which it seems just gives dead-ends with everything I try. The code that I have at the moment follows below. Everything seels to work fine until I try to do the actual import. I have tried importing without using macros, which works fine, but that doesn't solve my problem The macro variable datafile="&FolderPath/&&File&i" resolves to the right values, but when I run the macro, I get the following error (I have tried using PIPE to import the files, but that also doesn't seem to work in the server environment): Error NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to WORK.PARMS.PARMS.SLIST. ERROR: Physical file does not exist, /sasdata/prototype/card_markerting_analytics/mart/ABMH684/CAMPAIGN LEADS/PCUBED/Camp46_Apr2015/absa_cc_camp46_targetfile_ntf_absa_nvsc.txt. ERROR: Import unsuccessful. See SAS Log for details. SAS Code Data List_files; rc=FILENAME('FMyRep',"&FolderPath"); did=DOPEN('FMyRep'); memcnt=DNUM(did); DO i=1 TO memcnt; filevar=LOWCASE(DREAD(did,i)); IF LOWCASE(SCAN(filevar,-1,".")) EQ LOWCASE("&extension") THEN OUTPUT; END; rc=DCLOSE(did); rc=FILENAME('FMyRep'); KEEP filevar; RUN; DATA test; set List_files; where index(filevar,'absa_cc'); Count +1; call symputx('File'||left(put(Count , 3.)), filevar, 'l' ); call symputx('Count', Count , 'l' ); run; %put _user_; proc sql; select count(*) into: numfiles from test; quit; %macro import(); %do i = 1 %to &numfiles; proc import datafile="&FolderPath/&&File&i" out=_i replace dbms=dlm; delimiter='|'; run; %end; %mend; %import(); Any help solving this will be greatly appreciated!
... View more