Wouter
If your CSV files all have the same structure (same number of columns and data types) and,
if you were to use a data step instead of proc import,
then you would need no macro.
All you would need is an infile statement with an * in the physical file name where your &i is appearing.
You might have to handle "start/end-of-file" to exclude headers, but not much more.
Try this
data try( compress=yes) ;
length a b c d $30 filename $100 ;
infile 'L:\8th\TEST REQUESTS\03 Graphs\Financieel_AB_401_Day_*_09_2009.csv'
dsd truncover filename= filename eov=eov;
input a -- d ;
file= filename ;
row+1 ;
output ;
if eov ;
row =0 ;
eov =0 ;
run;
It provides a quick conversion of csv info into string columns, across all csv files which conform to that name pattern, in that folder, with just the first 4 columns of each row and the file name and row number within the file.
When you examine the content, it is easy to decide
1 how big to make the columns you want to store (drop statement for the others)
2 suitable names for the columns
so you'll know adapt the length statement (and input) and
3 introduce an informat statement to make suitable conversions and
4 probably a format statement to support things like converted dates and money.
What's more, since you are doing this on a repetitive basis, these data type decisions are unlikely to change from week to week.
hope you'll find these ideas useful
of course all that was irrelevant if you just wanted an exercise to make a few mistakes and learn a little more about writing and using macros;
PeterC