filename _expmac_ catalog 'sasuser.explorer.browse_os.source' ; data _null_; * file xactions(browse_os.source) lrecl=160; file _expmac_; input; put _infile_; datalines4; %macro browse_os ( lib, mem ) / des='Explore Containing Folder'; /* * Title: SAS Explorer Action - Explore Containing Folder * Purpose: WBROWSE the first directory containing a library member * Author: Richard A. DeVenezia * Date: 19feb05 * Notes: Only tested for single and concatenated local path librefs * No tests performed for cases of REMOTE librefs * or SAS/Access librefs such as ORACLE, ODBC, etc.. * * The two forms of lib tested are * - Single path name: Path does not start with ( * - Multiple path names: List of names starts with ( */ %local path; %let path = %sysfunc(pathname(&lib)); %if %qsubstr(&path,1,1) = %str(%() %then %do; gsub '%browse_os_aux'; %end; %if %length (&path) %then %do; wbrowse %sysfunc(quote(%quote(&path))) %end; %mend; %macro browse_os_aux; /* * Purpose: Search the paths of a concatenated libref for a member * Title: SAS Explorer Action - Explore Containing Folder, auxiliary handler * Author: Richard A. DeVenezia * Date: 19feb05 * Notes: Be aware that like named library members may exist * in folders farther into the concenation list. These are listed in * the log. * * Two macro variables are presumed to exist in callers scope * - path, a parenthesis bounded list of quote or dquote delimited items * - mem, member to search for */ data _null_; /* path used as an array initializer */ array paths[50] $250 _temporary_ &path; length path $250; call symput ('path', ''); do i = 1 to dim(paths) while (paths[i] ne ''); * put paths[i]=; * obtain system generated fileref to path; length fileref $8; fileref = ''; rc = filename (fileref, paths[i]); if rc = 0 then do; * scan files in path looking for member name; did = dopen (fileref); if did then do; do j = 1 to dnum(did); name = dread (did,j); * put name=; if %upcase("&mem") = upcase(scan(name,1,'.')) then do; * this path contains the member; if path = '' then do; path = paths[i]; call symput ('path', trim(path)); end; else do; * report other matches; put 'NOTE: ' paths[i] 'also contains ' name; end; end; end; did = dclose(did); end; rc = filename (fileref,''); end; end; run; %mend; ;;;; run; filename _expmac_ clear; %include xactions (browse_os.source);