<?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 Macro Debugging in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392004#M277723</link>
    <description>&lt;P&gt;I want to know how should I exactly point out the error location in an included sas macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g. If I am calling an included macro the log only tells me that error occured at the line where I call the macro. I have no information about where to serarch inside that huge included macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ex. the log looks like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%include "/abc/getMyOutput.sas";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5%getMyOutput();&lt;/P&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Division by zero detected at line&amp;nbsp;5 column x.&lt;/P&gt;
&lt;P&gt;WARNING: Limit set by ERRORS= option reached.&amp;nbsp; Further errors of this type will not be printed.&lt;BR /&gt;RULE:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea how I can see where inside that macro real problem occurs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See below code example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data y;&lt;/P&gt;
&lt;P&gt;c=5;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%include "./include.sas";&lt;/P&gt;
&lt;P&gt;%getit;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;%macro getit;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;data x;&lt;/P&gt;
&lt;P&gt;set y;&lt;/P&gt;
&lt;P&gt;a=5;&lt;/P&gt;
&lt;P&gt;b=c/0;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%mend getit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2017 20:17:53 GMT</pubDate>
    <dc:creator>SP_SAS</dc:creator>
    <dc:date>2017-08-30T20:17:53Z</dc:date>
    <item>
      <title>Macro Debugging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392004#M277723</link>
      <description>&lt;P&gt;I want to know how should I exactly point out the error location in an included sas macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g. If I am calling an included macro the log only tells me that error occured at the line where I call the macro. I have no information about where to serarch inside that huge included macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ex. the log looks like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%include "/abc/getMyOutput.sas";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5%getMyOutput();&lt;/P&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Division by zero detected at line&amp;nbsp;5 column x.&lt;/P&gt;
&lt;P&gt;WARNING: Limit set by ERRORS= option reached.&amp;nbsp; Further errors of this type will not be printed.&lt;BR /&gt;RULE:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea how I can see where inside that macro real problem occurs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See below code example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data y;&lt;/P&gt;
&lt;P&gt;c=5;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%include "./include.sas";&lt;/P&gt;
&lt;P&gt;%getit;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;%macro getit;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;data x;&lt;/P&gt;
&lt;P&gt;set y;&lt;/P&gt;
&lt;P&gt;a=5;&lt;/P&gt;
&lt;P&gt;b=c/0;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%mend getit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392004#M277723</guid>
      <dc:creator>SP_SAS</dc:creator>
      <dc:date>2017-08-30T20:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Debugging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392008#M277724</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Set the options above and you'll get the code in your log and you should be able to track the issue.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:04:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392008#M277724</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-30T20:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Debugging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392013#M277725</link>
      <description>&lt;P&gt;In addition to the two options that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;recommended, I'd also include the mlogic option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392013#M277725</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-08-30T20:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Debugging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392022#M277726</link>
      <description>&lt;P&gt;And turn of the options after you get things fixed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options nomprint nosymbolgen nomlogic;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392022#M277726</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-30T20:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Debugging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392028#M277727</link>
      <description>&lt;P&gt;I added all the options but it still does the same thing. see below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 options symbolgen mlogic mprint;&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;3 data y;&lt;/P&gt;
&lt;P&gt;4 c=5;&lt;/P&gt;
&lt;P&gt;5 run;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;NOTE: The data set WORK.Y has 1 observations and 1 variables.&lt;/P&gt;
&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;
&lt;P&gt;real time 0.00 seconds&lt;/P&gt;
&lt;P&gt;cpu time 0.02 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;6 %include "/include.sas";&lt;/P&gt;
&lt;P&gt;18 %getit;&lt;/P&gt;
&lt;P&gt;MLOGIC(GETIT): Beginning execution.&lt;/P&gt;
&lt;P&gt;MPRINT(GETIT): data x;&lt;/P&gt;
&lt;P&gt;MPRINT(GETIT): set y;&lt;/P&gt;
&lt;P&gt;MPRINT(GETIT): a=5;&lt;/P&gt;
&lt;P&gt;MPRINT(GETIT): b=c/0;&lt;/P&gt;
&lt;P&gt;MPRINT(GETIT): run;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;NOTE: Division by zero detected at line 18 column 26.&lt;/P&gt;
&lt;P&gt;2 The SAS System 16:19 Wednesday, August 30, 2017&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.&lt;/P&gt;
&lt;P&gt;c=5 a=5 b=. _ERROR_=1 _N_=1&lt;/P&gt;
&lt;P&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to&lt;/P&gt;
&lt;P&gt;missing values.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#ff00ff"&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#ff00ff"&gt;1 at 18:26&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;NOTE: There were 1 observations read from the data set WORK.Y.&lt;/P&gt;
&lt;P&gt;NOTE: The data set WORK.X has 1 observations and 3 variables.&lt;/P&gt;
&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;
&lt;P&gt;real time 0.00 seconds&lt;/P&gt;
&lt;P&gt;cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;　&lt;/P&gt;
&lt;P&gt;MLOGIC(GETIT): Ending execution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See above the place is given by line 18: column 26&lt;/P&gt;
&lt;P&gt;Now if you see above line 18 is the macro call. So it does not say inside the macro where exactly the error occurs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392028#M277727</guid>
      <dc:creator>SP_SAS</dc:creator>
      <dc:date>2017-08-30T20:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Debugging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392030#M277728</link>
      <description>&lt;P&gt;Add SOURCE2 to your %INCLUDE statement as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the error does tellyou the data set so hopefully that should allow you to see the section of code that needs fixing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: There were 1 observations read from the data set &lt;STRONG&gt;WORK.Y.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;NOTE: The data set&lt;STRONG&gt; WORK.X&lt;/STRONG&gt; has 1 observations and 3 variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392030#M277728</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-30T20:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Debugging</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392032#M277729</link>
      <description>&lt;P&gt;Yes, but what if you have hundreds of calculation in that data step. If it points me to a specific line then it is very easy.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 20:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Debugging/m-p/392032#M277729</guid>
      <dc:creator>SP_SAS</dc:creator>
      <dc:date>2017-08-30T20:54:11Z</dc:date>
    </item>
  </channel>
</rss>

