Hi, Here is my try based on previous comments... I tried to fully automate the process but unfortunately, SAS is not supporting Macro Variable creation in DIR Command of FILENAME Statement...otherwise it will be very easy to automate... So as you said you are having 700 Folders, what you can do, you can simply copy and paste the path in following code where i mentioned the comments...It's not tedious task... After that %FILES_IMPORT Macro will automatically append all the files in a folder and create the SAS dataset based on the folder name... filename in_dir pipe 'dir "C:\Documents and Settings\2011-08-15_2011-08-15"/b'; /*Change the folder here*/ data all; attrib buff format=$200.; infile in_dir; input buff $; run; proc sql noprint; select buff into :all_files separated by " " from all; quit; %put &all_files.; %let path = C:\Documents and Settings\2011-08-15_2011-08-15; /*Change the folder here*/ %macro files_import; %global dsn; %let dsn = %qscan(&path.,-1,"_"); %let dsn = %sysfunc(compress(&dsn.,"-")); %put &dsn.; %let tot_files = %eval(%qsysfunc(countc(&all_files.," "))+1); %put &tot_files.; filename myfiles (%do i = 1 %to %eval(&tot_files.-1); "&path.\%qscan(%str(&all_files.),&i.," ")", %end; "&path.\%qscan(%str(&all_files.),&tot_files.," ")"); data ALL_&dsn.; infile myfiles; input name $ age; run; %mend; %files_import; Hope it meets your requirement and will reduce the time to do the repititive task... -Urvish
... View more