<?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: Conditionally produce debugging information in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563145#M157825</link>
    <description>&lt;P&gt;You have to consider the entire example, and put it in a larger context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Context:&amp;nbsp; Suppose you have 10 PROC PRINTs and 5 PROC CONTENTs that you want to run only if there is trouble.&amp;nbsp; It's a lot of work to find and either comment or uncomment 15 procedures.&amp;nbsp; And you might miss one or two.&amp;nbsp; Instead, you can set up a macro variable that automatically turns all 15 procedures on or off.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; In the code that you posted, there was some careful work done beforehand when composing the program.&amp;nbsp; You can't just switch a macro variable on or off and expect it to do anything at all.&amp;nbsp; You have to build it into the program.&amp;nbsp; In your sample code, the programmer built in a macro condition:&amp;nbsp; %if &amp;amp;_ERROR %then .....&amp;nbsp; That was part of the planning, and part of the program that lets the setting of &amp;amp;_ERROR control whether or not the PROC PRINT executes.&lt;/P&gt;</description>
    <pubDate>Sun, 02 Jun 2019 17:19:33 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-06-02T17:19:33Z</dc:date>
    <item>
      <title>Conditionally produce debugging information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563099#M157811</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;What does it mean debug information?&lt;/P&gt;
&lt;P&gt;In which situation we need to use this type of code ?&lt;/P&gt;
&lt;P&gt;I will appreciate if anyone can explain it.&lt;/P&gt;
&lt;P&gt;I saw the defintion of debugging "&lt;STRONG&gt;Debugging&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;is the routine process of locating and removing computer program bugs, errors or abnormalities, which is methodically handled by software programmers via&lt;/SPAN&gt;&lt;STRONG&gt;debugging&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;tools.&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Debugging&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;checks, detects and corrects errors or bugs to allow proper program operation according to set specifications"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Joe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Conditionally produce debugging information */
%let _DEBUG = 0; /* set to 1 for debugging */
%if &amp;amp;_DEBUG. %then
  %do;
    proc print data=sashelp.class(obs=10);
    run;
  %end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2019 17:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563099#M157811</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-06-01T17:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally produce debugging information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563101#M157813</link>
      <description>&lt;P&gt;Some of us programmers who are not as talented as you are ... we occasionally make mistakes.&amp;nbsp; We might want additional information to help us figure out where the mistakes are and what to fix.&amp;nbsp; In this case, that information is to print the first ten observations of a data set.&amp;nbsp; But once the mistakes are fixed, we don't want to print those 10 observations any more.&amp;nbsp; So in this example, the debugging information is the printing of 10 observations that we can turn on by setting &amp;amp;_DEBUG to 1, and turn off by setting &amp;amp;_DEBUG to 0.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2019 17:05:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563101#M157813</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-01T17:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally produce debugging information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563102#M157814</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;Usually I&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;turn off&amp;nbsp; print by put it in notes (/************************/)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As I understand ,alternatively, I can change the value in %let&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;_DEBUG from 0 to 1&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="sas"&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt; _DEBUG = &lt;SPAN&gt;0&lt;/SPAN&gt;;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2019 17:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563102#M157814</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-06-01T17:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally produce debugging information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563103#M157815</link>
      <description>&lt;P&gt;There are no builtin options in sas to debug a program.&lt;/P&gt;
&lt;P&gt;You can find some system variables to be checked: &amp;amp;syserr, &amp;amp;sysrc and others.&lt;/P&gt;
&lt;P&gt;Usually if you observe an error, either in log or in your output, you need to DEBUG your program&lt;/P&gt;
&lt;P&gt;by adding specific code which should not run after all errors corrected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use a flag to define whether to run your debugging code or not, like in your example,&lt;/P&gt;
&lt;P&gt;or you can enclose that code by *...; or by /*....*/.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you prefer the 2nd method, than you can easily find that specific code if you mark it as::&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*DEBUG*/ ... any debugging code ...  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jun 2019 19:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563103#M157815</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-06-01T19:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Conditionally produce debugging information</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563145#M157825</link>
      <description>&lt;P&gt;You have to consider the entire example, and put it in a larger context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Context:&amp;nbsp; Suppose you have 10 PROC PRINTs and 5 PROC CONTENTs that you want to run only if there is trouble.&amp;nbsp; It's a lot of work to find and either comment or uncomment 15 procedures.&amp;nbsp; And you might miss one or two.&amp;nbsp; Instead, you can set up a macro variable that automatically turns all 15 procedures on or off.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; In the code that you posted, there was some careful work done beforehand when composing the program.&amp;nbsp; You can't just switch a macro variable on or off and expect it to do anything at all.&amp;nbsp; You have to build it into the program.&amp;nbsp; In your sample code, the programmer built in a macro condition:&amp;nbsp; %if &amp;amp;_ERROR %then .....&amp;nbsp; That was part of the planning, and part of the program that lets the setting of &amp;amp;_ERROR control whether or not the PROC PRINT executes.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 17:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditionally-produce-debugging-information/m-p/563145#M157825</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-02T17:19:33Z</dc:date>
    </item>
  </channel>
</rss>

