<?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 How to find the list of Macros available in the SAS sessions. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824365#M325565</link>
    <description>&lt;P&gt;For our projects some macros are called into the session using a project setup macro from a specific folder, some times we use SASAUTOS options.&amp;nbsp; People who are in the project are not aware of what macros are available . Is there any way we can find out the list of macros available during the sessions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your advise in advance.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2022 14:11:20 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2022-07-20T14:11:20Z</dc:date>
    <item>
      <title>How to find the list of Macros available in the SAS sessions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824365#M325565</link>
      <description>&lt;P&gt;For our projects some macros are called into the session using a project setup macro from a specific folder, some times we use SASAUTOS options.&amp;nbsp; People who are in the project are not aware of what macros are available . Is there any way we can find out the list of macros available during the sessions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your advise in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824365#M325565</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-07-20T14:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the list of Macros available in the SAS sessions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824368#M325568</link>
      <description>&lt;P&gt;You could use the SASHELP.VCATALG SAS Data View:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data macros ;
	set sashelp.vcatalg ;
	where objtype="MACRO" ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:24:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824368#M325568</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2022-07-20T14:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the list of Macros available in the SAS sessions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824371#M325571</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226241"&gt;@AMSAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You could use the SASHELP.VCATALG SAS Data View:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data macros ;
	set sashelp.vcatalg ;
	where objtype="MACRO" ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That would only find macros that have already been compiled.&amp;nbsp; It would not search the directories listed in the SASAUTOS option to find any available autocall macros that have not yet been called.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For that you might want to write a data step that loops over the directories and opens them and uses DREAD() to extract the filenames and find any that look like "macroname.sas".&amp;nbsp; &amp;nbsp; You might get a start by looking at this macro&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/maclist.sas" target="_blank"&gt;https://github.com/sasutils/macros/blob/master/maclist.sas&lt;/A&gt;.&amp;nbsp; But that macro is trying to do the reverse which is locate the source code for the macros that have already been compiled.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824371#M325571</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-20T14:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the list of Macros available in the SAS sessions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824373#M325572</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; you are correct, It given only&amp;nbsp; that are already compiled , I could not see any&amp;nbsp; macros that suppose to see. I tried these two. Can please provide a sample code that you mentioned.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   create table xx as select * 
    from dictionary.catalogs
    where objtype='MACRO'
   ;
quit;

proc sql noprint;
   create table yy as select * 
    from sashelp.vcatalg
    where objtype='MACRO'
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1658328056501.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73523iCBC30BF0E86A01CD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1658328056501.png" alt="SASuserlot_0-1658328056501.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824373#M325572</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-07-20T14:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the list of Macros available in the SAS sessions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824375#M325573</link>
      <description>&lt;P&gt;Get this list of directories&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data paths ;
  length autos dlist path $32767 ;
  autos=getoption('sasautos');
  do i=1 by 1 until (path= ' ');
    path=scan(autos,i,'( )','q');
    if length(path) &amp;lt;= 8 then do;
        if 0=fileref(path) then path=pathname(path) ;
    end;
    dlist=left(trim(dlist)||' '||path);
  end;
  length dirnum 8 directory $256 ;
  do dirnum=1 to countw(dlist,'( )','q');
    directory=dequote(scan(dlist,dirnum,'( )','q'));
    output;
  end;
  keep dirnum directory;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now scan the directories for files that look like they could be autocall macros.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data macros;
  length dirnum filenum 8 macro $32 filename $256 ;
  set paths;
  fileref='macdir';
  rc=filename(fileref,directory);
  did=dopen(fileref);
  do filenum=1 to dnum(did);
    filename=dread(did,filenum);
    if lowcase(scan(filename,-1,'.'))='sas' then do;
      macro = substrn(filename,1,length(filename)-4);
      if length(macro) &amp;lt;= 32 and nvalid(macro,'v7') and macro=lowcase(macro) then output;
    end;
  end;
  rc=dclose(did);
  rc=filename(fileref);
  keep dirnum filenum macro directory filename ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here are the first few results on my PC&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1658329127091.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73524i8F010553C65274C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1658329127091.png" alt="Tom_0-1658329127091.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:58:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824375#M325573</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-20T14:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the list of Macros available in the SAS sessions.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824378#M325575</link>
      <description>&lt;P&gt;Thanks it worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 15:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-list-of-Macros-available-in-the-SAS-sessions/m-p/824378#M325575</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-07-20T15:09:34Z</dc:date>
    </item>
  </channel>
</rss>

