<?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 What is macro global debug variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-is-macro-global-debug-variable/m-p/458294#M116272</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dear&lt;/P&gt;
&lt;P&gt;I need help in understanding about global debug variable. In our programming documentation it shows "include a global debug variable (‘analysis’ turns on resolved code generation)". I do not understand this statement.&amp;nbsp; Most of SAS code looks like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am assuming the "debug " name is just used as a macro variable and &amp;amp;debug resolves to "N". Please suggest any documentation this. i searched&amp;nbsp; various macro debugging online documents did not see what i need. Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let var_debug='N';&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;%macro adam(debug = &amp;amp;var_debug); &lt;BR /&gt;%if %qupcase(&amp;amp;debug)=%quote(ANALYSIS) %then %do; &lt;BR /&gt; %let _tpath=%sysfunc(pathname(tol)); &lt;BR /&gt; filename mprint "&amp;amp;_path./adam_output.gen.sas" lrecl=2048; &lt;BR /&gt; %let rc=%sysfunc(fdelete(mprint)); &lt;BR /&gt; options nomautolocdisplay mfile mprint; &lt;BR /&gt; %end;&lt;/P&gt;
&lt;P&gt;"other sas statements" &lt;BR /&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 28 Apr 2018 00:34:25 GMT</pubDate>
    <dc:creator>knveraraju91</dc:creator>
    <dc:date>2018-04-28T00:34:25Z</dc:date>
    <item>
      <title>What is macro global debug variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-macro-global-debug-variable/m-p/458294#M116272</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dear&lt;/P&gt;
&lt;P&gt;I need help in understanding about global debug variable. In our programming documentation it shows "include a global debug variable (‘analysis’ turns on resolved code generation)". I do not understand this statement.&amp;nbsp; Most of SAS code looks like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am assuming the "debug " name is just used as a macro variable and &amp;amp;debug resolves to "N". Please suggest any documentation this. i searched&amp;nbsp; various macro debugging online documents did not see what i need. Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let var_debug='N';&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;%macro adam(debug = &amp;amp;var_debug); &lt;BR /&gt;%if %qupcase(&amp;amp;debug)=%quote(ANALYSIS) %then %do; &lt;BR /&gt; %let _tpath=%sysfunc(pathname(tol)); &lt;BR /&gt; filename mprint "&amp;amp;_path./adam_output.gen.sas" lrecl=2048; &lt;BR /&gt; %let rc=%sysfunc(fdelete(mprint)); &lt;BR /&gt; options nomautolocdisplay mfile mprint; &lt;BR /&gt; %end;&lt;/P&gt;
&lt;P&gt;"other sas statements" &lt;BR /&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Apr 2018 00:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-macro-global-debug-variable/m-p/458294#M116272</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2018-04-28T00:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: What is macro global debug variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-macro-global-debug-variable/m-p/458296#M116274</link>
      <description>&lt;P&gt;I believe this is a portion of code from a recent SAS post that illustrates how to debug your code with a debug option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the full post here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Include-Debugging-Code-in-Your-Programs/ta-p/447652" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Include-Debugging-Code-in-Your-Programs/ta-p/447652&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a method/style of programming and as such wouldn't be documented.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The functions and logical syntax is documented in the macro section.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Include-Debugging-Code-in-Your-Programs/ta-p/447652" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Include-Debugging-Code-in-Your-Programs/ta-p/447652&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Apr 2018 01:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-macro-global-debug-variable/m-p/458296#M116274</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-28T01:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: What is macro global debug variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-macro-global-debug-variable/m-p/458306#M116278</link>
      <description>&lt;P&gt;Let's look at the example code you posted and see what it is doing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let var_debug='N';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is setting the macro variable VAR_DEBUG to an uppercase letter n enclosed in single quotes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro adam(debug = &amp;amp;var_debug);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is beginning the definition of macro named ADAM that has one non-positional parameter named DEBUG whose default value (ie when the caller does not supply a value) that is value of the macro variable VAR_DEBUG.&amp;nbsp; To use this macro you should make sure to define the macro variable VAR_DEBUG before you call the macro ADAM.&amp;nbsp; Otherwise when the macro tries to reference the value of DEBUG you will get a warning in the SAS log like this:&lt;/P&gt;
&lt;PRE&gt;WARNING: Apparent symbolic reference VAR_DEBUG not resolved.&lt;/PRE&gt;
&lt;P&gt;Now this block of code in the macro is testing the value of the DEBUG parameter.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %qupcase(&amp;amp;debug)=%quote(ANALYSIS) %then %do; 
  %let _tpath=%sysfunc(pathname(tol)); 
  filename mprint "&amp;amp;_path./adam_output.gen.sas" lrecl=2048; 
  %let rc=%sysfunc(fdelete(mprint)); 
  options nomautolocdisplay mfile mprint; 
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Only if the value of DEBUG is the word ANALYSIS (without regard to case of the letters) will it create the fileref and change the option settings.&amp;nbsp; It looks like the purpose is to turn on the MFILE option to direct the code that the macro generates to a file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that there is no need to add the %quote() around the constant text ANALYSIS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To prevent the warning if VAR_DEBUG has not been defined you could add this line before the %IF statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if not %symexist(var_debug) %then %local var_debug ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Apr 2018 04:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-macro-global-debug-variable/m-p/458306#M116278</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-28T04:36:09Z</dc:date>
    </item>
  </channel>
</rss>

