<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Finding Location of SAS Macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292762#M60826</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also have a look at the&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#n0rgycsomlut20n1a13vgaf9j7f3.htm" target="_blank"&gt;MAUTOLOCINDES&lt;/A&gt; SAS System Option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is what the doc says:&lt;/P&gt;
&lt;P&gt;Specifies whether the macro processor prepends the full pathname of the autocall source file to the description field of the catalog entry of compiled autocall macro definition in the Work.SASMacr catalog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2016 15:38:47 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2016-08-19T15:38:47Z</dc:date>
    <item>
      <title>Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292642#M60789</link>
      <description>&lt;P&gt;I have been going through SAS code written by others, which references a number of macros in folders around a large corporate network and I don't really know what many of these functions do. Is there a way of locating where SAS is finding the code for an individual function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if I put in a macro name for example rather than carrying out the instructions of the macro it would tell my the file path to where the code is located.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 04:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292642#M60789</guid>
      <dc:creator>chris_e</dc:creator>
      <dc:date>2016-08-19T04:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292649#M60792</link>
      <description>&lt;P&gt;run PROC OPTIONS and look for SASAUTOS in the log.&lt;/P&gt;&lt;P&gt;It may give you a hint where to search the macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shmuel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 05:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292649#M60792</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-08-19T05:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292653#M60794</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a look the &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#p04o0tz0t7g88in1mqlh27hj7wgn.htm" target="_blank"&gt;MAUTOLOCDISPLAY &lt;/A&gt;SAS System Option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you call an autocall macro, it will display the location of the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also have a look at other macro related SAS System Options here &lt;A href="http://support.sas.com/documentation/cdl/en/allprodslang/68037/HTML/default/viewer.htm#syntaxByCategory-macroSystemOptions.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/allprodslang/68037/HTML/default/viewer.htm#syntaxByCategory-macroSystemOptions.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 06:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292653#M60794</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-08-19T06:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292668#M60802</link>
      <description>I remember &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; has already post a solution for someone, Ask him.
&lt;PRE&gt;


%let x=%sysfunc(pathname(sasautos));

%put &amp;amp;x ;

&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2016 08:10:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292668#M60802</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-19T08:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292713#M60818</link>
      <description>&lt;P&gt;If you are using autocall macros I have a program that you can run at the end of your program that&amp;nbsp;will&amp;nbsp;read the list of compiled macros from WORK.SASMACR and try to find corresponding files in the SASAUTOS paths that match the macro names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you can re-run your complicated program and then call this at the end you can get a report of which macros the program called. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For this to work you need to use autocall macros and not stored compiled macro catalogs. &amp;nbsp;Also you need to be careful to define only one macro in each source code file in your autocall library. &amp;nbsp;Also if you have a complicated program with conditional branches it will only find the macros that were actually called. It won't find any that the code might use in branches of the code that did not run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro maclist
/*----------------------------------------------------------------------
Generate list of compiled macros and their source directories
----------------------------------------------------------------------*/
(out=maclist   /* Name of dataset to generate */
,dlist=        /* Directory list to scan (default=SASAUTOS option) */
);
/*----------------------------------------------------------------------
Produce a summary dataset with the location of the source file for the
compiled macros currently in SASHELP.SASMACR catalog by scanning across
SASAUTOS search path to see if corresponding file exists.

When using SAS 9.2 or higher it will use to Q modifier on the SCAN()
function to allow pathnames to include parentheses when properly quoted.

----------------------------------------------------------------------*/

data &amp;amp;out ;
  attrib MACRO length=$32  label='Macro name';
  attrib FOUND length=3    label='Found? (0/1)';
  attrib FILE  length=$36  label='Filename';
  attrib DNAME length=$200 label='Directory name';
  keep macro found file dname;

  if _n_=1 then do;
*----------------------------------------------------------------------;
* Get SASAUTOS option into string variable and copy individual paths ;
* into DLIST, expanding any filerefs that are found (such as SASAUTOS).;
*----------------------------------------------------------------------;
    length dlist autos path $32767 ;
    retain dlist ;
%if %length(&amp;amp;dlist) %then %do;
    autos=%sysfunc(quote(&amp;amp;dlist));
%end;
%else %do;
    autos=getoption('sasautos');
%end;
    do i=1 by 1 until (path= ' ');
%if %sysevalf(9.2 &amp;lt;= &amp;amp;sysver) %then %do;
      path=scan(autos,i,'( )','q');
%end;
%else %do;
      path=scan(autos,i,'( )');
%end;
      if length(path) &amp;lt;= 8 then do;
        if 0=fileref(path) then path=pathname(path) ;
      end;
      dlist=left(trim(dlist)||' '||path);
    end;
  end;

  set sashelp.vcatalg;
  where libname='WORK' and memname='SASMACR'
    and memtype='CATALOG' and objtype='MACRO';
  macro=objname;
  file=lowcase(trim(macro))||'.sas';

*----------------------------------------------------------------------;
* Scan through the paths in DLIST until file found or end of list ;
*----------------------------------------------------------------------;
  found=0;
  done=0;
  do i=1 by 1 until (found or done);
%if %sysevalf(9.2 &amp;lt;= &amp;amp;sysver) %then %do;
    dname=dequote(scan(dlist,i,'( )','q'));
%end;
%else %do;
    dname=dequote(scan(dlist,i,'( )'));
%end;
    if dname=' ' then done=1;
    else if fileexist(trim(dname)||'/'||trim(file)) then found=1;
  end;
  if ^found then dname=' ';
run;

%mend maclist;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2016 12:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292713#M60818</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-08-19T12:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292762#M60826</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also have a look at the&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#n0rgycsomlut20n1a13vgaf9j7f3.htm" target="_blank"&gt;MAUTOLOCINDES&lt;/A&gt; SAS System Option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is what the doc says:&lt;/P&gt;
&lt;P&gt;Specifies whether the macro processor prepends the full pathname of the autocall source file to the description field of the catalog entry of compiled autocall macro definition in the Work.SASMacr catalog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 15:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/292762#M60826</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-08-19T15:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/293321#M61012</link>
      <description>&lt;P&gt;Thanks bruno this seems to work&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 03:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/293321#M61012</guid>
      <dc:creator>chris_e</dc:creator>
      <dc:date>2016-08-23T03:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Finding Location of SAS Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/293323#M61014</link>
      <description>&lt;P&gt;Thanks for the program Tom it'd be good to run on large programs.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 03:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-Location-of-SAS-Macros/m-p/293323#M61014</guid>
      <dc:creator>chris_e</dc:creator>
      <dc:date>2016-08-23T03:47:38Z</dc:date>
    </item>
  </channel>
</rss>

