<?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: Identify location of macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877948#M346859</link>
    <description>I believe it's a autocall macro. Still the options compilenote helps?&lt;BR /&gt;</description>
    <pubDate>Sun, 28 May 2023 18:36:10 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2023-05-28T18:36:10Z</dc:date>
    <item>
      <title>Identify location of macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877943#M346856</link>
      <description>&lt;P&gt;We're calling the macro as below which will help identify the environment (dev, test, prod) and the job name. Can someone help me where can I find the macro definition for the same? I searched in few folders for this macro but I couldn't locate it. I checked the log of this macro but I couldn't identify the location of the macro %env_jobname.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options symbolgen mlogic mprint;

%env_jobname(var_name=path);&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 May 2023 18:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877943#M346856</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2023-05-28T18:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Identify location of macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877947#M346858</link>
      <description>&lt;P&gt;Can you start a new session, then run that code and post the log?&amp;nbsp; If %ENV_JOBNAME is an autocall macro, mlogic should write a note to the log when it is compiled.&amp;nbsp; If the macro isn't an autocall macro, than you might try turning on system option mcompilenote=ALL.&amp;nbsp; That will write a note to the log when macro is compiled, so you could run the code (in a fresh SAS session), and then search the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below shows the log I get from testing it out with %lowcase, which is an autocall macro provided by SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    options mlogic mcompilenote=all;

2    %put %lowcase(FOO);
MLOGIC:  Beginning compilation of LOWCASE using the autocall file C:\Program
      Files\SASHome\SASFoundation\9.4\core\sasmacro\lowcase.sas.
NOTE: The macro LOWCASE completed compilation without errors.
      29 instructions 504 bytes.
MLOGIC(LOWCASE):  Beginning execution.
MLOGIC(LOWCASE):  This macro was compiled from the autocall file C:\Program
      Files\SASHome\SASFoundation\9.4\core\sasmacro\lowcase.sas
MLOGIC(LOWCASE):  Parameter STRING has value FOO
MLOGIC(LOWCASE):  Ending execution.
foo
&lt;/PRE&gt;
&lt;P&gt;You would want to set these options as early as possible in your SAS session, as it could be that that macro is created by running an autoexec file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 May 2023 18:32:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877947#M346858</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-05-28T18:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Identify location of macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877948#M346859</link>
      <description>I believe it's a autocall macro. Still the options compilenote helps?&lt;BR /&gt;</description>
      <pubDate>Sun, 28 May 2023 18:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877948#M346859</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2023-05-28T18:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Identify location of macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877949#M346860</link>
      <description>&lt;P&gt;Yes, MCOMPILENOTE=ALL works for autocall macros.&amp;nbsp; The documentation is:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1rsjy2cpe7b6on1goigucu4f5vv.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1rsjy2cpe7b6on1goigucu4f5vv.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That option will tell you *when* a macro is compiled, but it doesn't tell you the location of the file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MLOGIC tells you the location of an autocall macro when it is compiled (and each time it is executed).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you couldn't use MLOGIC for some reason, you could use MAUTOLOCDISPLAY:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;12   options nomlogic mautolocdisplay;
13   %put %lowcase(FOO);
MAUTOLOCDISPLAY(LOWCASE):  This macro was compiled from the autocall file C:\Program
                           Files\SASHome\SASFoundation\9.4\core\sasmacro\lowcase.sas
foo
&lt;/PRE&gt;
&lt;P&gt;That said, if you turn on MLOGIC and run the macro call and it does NOT show the location, that means the macro is not an autocall macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In below example, I turn on MLOGIC.&amp;nbsp; When I call %lowcase() the location is printed, because it's an autocall macro.&amp;nbsp; When I call %foo the location is not printed, because it's not an autocall macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;60   options mlogic;
61
62   %lowcase()
MLOGIC(LOWCASE):  Beginning execution.
MLOGIC(LOWCASE):  This macro was compiled from the autocall file C:\Program
      Files\SASHome\SASFoundation\9.4\core\sasmacro\lowcase.sas
MLOGIC(LOWCASE):  Parameter STRING has value
MLOGIC(LOWCASE):  Ending execution.
63
64   %foo()
MLOGIC(FOO):  Beginning execution.
MLOGIC(FOO):  %PUT hi
hi
MLOGIC(FOO):  Ending execution
&lt;/PRE&gt;</description>
      <pubDate>Sun, 28 May 2023 18:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877949#M346860</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-05-28T18:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Identify location of macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877961#M346862</link>
      <description>&lt;P&gt;One more place I would look would be some of "autoexec.sas" files, maybe one of the workspace server? Macro definition could be hidden there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For list of autocall directories you can run:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=SET;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Maybe it will show you some locations you missed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is not from autoexec or autocall, it may be one stored in a catalog.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that is the case, it will be rather bad situation because even you try read the catalog content:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro MyMacro();
%if &amp;amp;x.=1 %then
  %do;
  options mprint mlogic symbolgen;
    data abc;
      x = 1;
      y = 2;
      z = x + y;
      put "Can you see me??:-)";
      put _all_;
    run;
  %end;
%mend MyMacro;

filename os catalog 'work.sasmacr.MyMacro.macro';
data _null_;
  infile os;
  input;
  put _INFILE_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output in the log&amp;nbsp; would be rather messy:&lt;/P&gt;
&lt;PRE&gt;1    %macro MyMacro();
2    %if &amp;amp;x.=1 %then
3      %do;
4      options mprint mlogic symbolgen;
5        data abc;
6          x = 1;
7          y = 2;
8          z = x + y;
9          put "Can you see me??:-)";
10         put _all_;
11       run;
12     %end;
13   %mend MyMacro;
14
15   filename os catalog 'work.sasmacr.MyMacro.macro';
16   data _null_;
17     infile os;
18     input;
19     put _INFILE_;
20   run;

NOTE: The infile OS is:
      Catalog Name=WORK.SASMACR.MYMACRO.MACRO,
      Catalog Page Size=4096,
      Number of Catalog Pages=246,
      Created=Sun, May 28, 2023 09:06:15 PM,
      Last Modified=Sun, May 28, 2023 09:06:15 PM,
      Filename=********************\sasmacr.sas7bcat,
      Release Created=9.0401M8,
      Host Created=X64_10PRO,
      Owner Name=YABWONL5P\bart,
      File Size=           981KB,
      File Size (bytes)=1004544

&amp;#1;   &amp;#7; MYMACRO                           vZ  9.4                         &amp;#16;@      ¤   &amp;#11;   4&amp;#1;  0   &amp;#20;   &amp;#12;
&amp;amp;   &amp;#2;   &amp;#2;
&amp;#5;   	   &amp;#5;   &amp;amp;x.=1
&amp;amp;   &amp;#3;   &amp;#3;
&amp;amp;   &amp;#4;   &amp;#11;
&amp;#3;   —      options mprint mlogic symbolgen;     data abc;       x = 1;       y = 2;       z = x + y;       put "Can you
see me??:-)";       put _all_;     run;
&amp;amp;   &amp;#12;   &amp;#12;
&amp;amp;   &amp;#12;   &amp;#12;
&amp;#6;       	
&amp;amp;   &amp;#12;   &amp;#12;
&amp;#4;
#   &amp;#11;       &amp;#16;   (   8   H   ì   ü   &amp;#12;&amp;#1;   &amp;#1;  0&amp;#1;
NOTE: 12 records were read from the infile OS.
      The minimum record length was 4.
      The maximum record length was 163.
NOTE: DATA statement used (Total process time):
      real time           0.43 seconds
      user cpu time       0.04 seconds
      system cpu time     0.21 seconds
      memory              315.40k
      OS Memory           24060.00k
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Sun, 28 May 2023 19:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/877961#M346862</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-05-28T19:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Identify location of macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/878063#M346904</link>
      <description>&lt;P&gt;You might want to try this old macro (created before those new fangled system options existed).&lt;/P&gt;
&lt;P&gt;&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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will get the list of currently compiled macros and try to find if there is a file with that name in the directories listed in the SASAUTOS system option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 16:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identify-location-of-macro/m-p/878063#M346904</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-29T16:31:31Z</dc:date>
    </item>
  </channel>
</rss>

