<?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: Macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447632#M283364</link>
    <description>&lt;P&gt;And&lt;/P&gt;
&lt;P&gt;Options nomprint nosymbolgen; to turn it off.&lt;/P&gt;
&lt;P&gt;You can use the MPRINT SYMBOLGEN individually.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 23:24:16 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-21T23:24:16Z</dc:date>
    <item>
      <title>Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447621#M283361</link>
      <description>&lt;P&gt;%macro cols1;&lt;BR /&gt;name age;&lt;BR /&gt;%mend;&lt;BR /&gt;%macro cols2;&lt;BR /&gt;height weight&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.proc print data=sashelp.class;&lt;BR /&gt;var %cols2 %cols1 ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.proc print data=sashelp.class;&lt;BR /&gt;var %cols1 %cols2 ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;I am getting result when i used first proc print, Error for second one.Please any one explain.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 22:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447621#M283361</guid>
      <dc:creator>Prasad84</dc:creator>
      <dc:date>2018-03-21T22:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447626#M283362</link>
      <description>&lt;P&gt;First introduce a basic diagnostic tool: Options mprint symbolgen;&lt;/P&gt;
&lt;P&gt;If you run that code before something using macros the resolution of the macros (and the associated error messages) appear more like non-macro code in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally it helps to show the code and the error messages from the log. Copy from the Log and paste into a code box opened using the forum {I} menu icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the macro Cols1 has ; as part of the value with the variables and Cols2 does not.&lt;/P&gt;
&lt;PRE&gt;2709
2710  %macro cols1;
2711  name age;
2712  %mend;
NOTE: The macro COLS1 completed compilation without errors.
      5 instructions 60 bytes.
2713  %macro cols2;
2714  height weight
2715  %mend;
NOTE: The macro COLS2 completed compilation without errors.
      5 instructions 64 bytes.
2716
2717  options mprint symbolgen;
2718
2719  proc print data=sashelp.class;
NOTE: Writing HTML Body file: sashtml5.htm
2720  var %cols2 %cols1 ;
MPRINT(COLS2):   height weight
MPRINT(COLS1):   name age;
2721  run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.85 seconds
      cpu time            0.48 seconds


2722
2723  proc print data=sashelp.class;
2724  var %cols1 %cols2 ;
MPRINT(COLS1):   name age;
NOTE: Line generated by the invoked macro "COLS2".
1      height weight
       ------
       180
MPRINT(COLS2):   height
ERROR 180-322: Statement is not valid or it is used out of proper order.
2725  run;
MPRINT(COLS2):   weight

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


&lt;/PRE&gt;
&lt;P&gt;So you see in the second Proc print that the var statement looks like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var name age; height weight;&lt;/P&gt;
&lt;P&gt;and the first ; ends the VAR so height is treated as an&amp;nbsp;unknown option for proc print and throws the error.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 23:10:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447626#M283362</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-21T23:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447629#M283363</link>
      <description>Got it.Thanks a lot&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Mar 2018 23:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447629#M283363</guid>
      <dc:creator>Prasad84</dc:creator>
      <dc:date>2018-03-21T23:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447632#M283364</link>
      <description>&lt;P&gt;And&lt;/P&gt;
&lt;P&gt;Options nomprint nosymbolgen; to turn it off.&lt;/P&gt;
&lt;P&gt;You can use the MPRINT SYMBOLGEN individually.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 23:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447632#M283364</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-21T23:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447639#M283365</link>
      <description>&lt;P&gt;Semi-colons are very important in SAS syntax.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 23:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/447639#M283365</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-21T23:55:10Z</dc:date>
    </item>
  </channel>
</rss>

