filename _expmac_ catalog 'sasuser.explorer.export_af.source' ; data _null_; * file xactions (export_af.source); file _expmac_; input; put _infile_; datalines4; %macro export_af ( lib, mem, obj, typ, exportRoot= ); %if %length (&exportRoot) = 0 %then %let exportRoot = %sysfunc(pathname(WORK)); /* * Title: SAS Explorer Action - Export * Purpose: Export SCL entry to external file * Author: Richard A. DeVenezia * Date: 20feb05 * * This macro should reside in an autocall or stored library * autocall: options sasautos=...; * stored: options mstored sasmstore=...; */ %local exportPath; gsub '%export_af_aux'; build &lib..&mem..&obj..&typ browse=yes; file "&exportPath.&obj..&typ" replace; cancel; wbrowse "&exportPath."; %mend; %macro export_af_aux; options noxwait xsync xmin; data _null_; fullpath = "&exportRoot.\&lib.\&mem.\"; length currpath testpath $250; if fullpath = '\\' then currpath = '\\' || scan(fullpath,1,'\/') || '\'; else currpath = scan(fullpath,1,'\/') || '\'; do i = 2 by 1 while (scan(fullpath,i,'\/') ne ''); path = scan(fullpath,i,'\/'); testpath = trim(currpath) || path; if not fileexist (testpath) then do; %if %sysfunc(floor(&sysver)) >= 9 %then %do; currpath = dcreate (path, currpath); put 'Note: Created directory ' testpath; %end; %else %do; command = 'mkdir ' || quote(testpath); rc = system (command); put 'Note: Created directory ' testpath; currpath = ''; %end; end; else currpath = ''; if currpath = '' then currpath = trim(testpath) || '\'; else currpath = trim(currpath) || '\'; end; call symput ("exportPath", trim(currpath)); run; %mend; ;;;; run; filename _expmac_ clear; %include xactions (export_af.source);