cleanLib.sas
/*
* Richard A. DeVenezia
* 2/23/2005
*/
%macro cleanLib (base=, clean=);
%let basePaths = %qsysfunc (pathname(&base));
%let cleanPaths = %qsysfunc (pathname(&clean));
%if %qsubstr(&basePaths,1,1) = %str(%() %then
%let basePaths = %substr(&basePaths,2,%eval(%length(&basePaths)-2));
%if %qsubstr (&cleanPaths,1,1) = %str(%() %then
%let cleanPaths = %substr(&cleanPaths,2,%eval(%length(&cleanPaths)-2));
%let basePaths = %sysfunc (tranwrd(&basePaths,&cleanPaths,%str(-clean-)));
%let basePaths = %sysfunc (tranwrd(&basePaths,"-clean-",%str()));
%let basePaths = %sysfunc (tranwrd(&basePaths,'-clean-',%str()));
%let basePaths = %sysfunc (tranwrd(&basePaths,-clean-,%str()));
libname &base.
%if %length(&basePaths.) > 0 %then ( &basePaths. ) ;
;
%mend;