Try this macro (untested): %macro libnames; %let root='C:\Users\desktop\folder'; data _null_; set list_of_folders(keep=folder_name) nobs=nobs; /* SAS Dataset containing the names of the folders */ if _N_=1 then call symput("N_Libs",nobs); folder=cats("Folder",_N_); library=cats("Lib",_N_); lib_name=cats('L',substr(folder_name,1,4),substr(folder_name,7,2)); call symput(folder,folder_name); call symput(library,lib_name); run; %let i=1; %do %while (&i <= &N_Libs) libname &&Lib&i "&root.\&&Folder&i"; %let i= %eval(&i+1); %end; %mend libnames; %libnames The Data _null_ step creates the 80+ macrovariables containing the librefs (i.e. L032113, L050513, etc) and folder_names. Hope this helps,
... View more