Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading multiple CSV files with Macro, but generates only errors...

Status
Not open for further replies.

wphupkes

Technical User
Jul 1, 2008
22
NL
Hi,

I hope anyone could help me out with the following. I want to read multiple files (from 1 till 30), placed in 1 dir, with the use of macro's (best way to do this I think). But... my version of the program only generates errors (by the way; I haven't looked yet for a solution to go over the 10, so I'll use i=1 to 9). It doesn't recognize the filename with the &i in it...:

%macro import_files;
%do i=1 %to 9;


PROC IMPORT DATAFILE= 'L:\8th\TEST REQUESTS\03 Graphs\Financieel_AB_401_Day_0&i_09_2009.csv'
OUT= work.AB_401_&i
DBMS=DLM REPLACE;
DELIMITER='3B'x;
GETNAMES=YES;
DATAROW=2;
RUN;
%end;
%mend;

%import_files
 


Hello,
Try the double quote:
PROC IMPORT DATAFILE= "L:\8th\TEST REQUESTS\03 Graphs\Financieel_AB_401_Day_0&i_09_2009.csv"
Cheers
 
Thanks, but the double quotes don't work either:

"Apparent symbolic reference I_09_2009 not resolved".
 
GOT IT!

I had to place a dot after the &i (and use the double quotation marks):

PROC IMPORT DATAFILE= ".......\Financieel_AB_401_Day_0&i._09_2009.csv'

Thanks for your input!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top