<?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: macro question in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95272#M26969</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so it turns that 02APR13 instead of 02apr13 made a big change.Is that what you mean by Comparisons are case sensitive?&lt;/P&gt;&lt;P&gt;cuz now with 02APR13 i see the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks guys&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Apr 2013 21:05:56 GMT</pubDate>
    <dc:creator>Tal</dc:creator>
    <dc:date>2013-04-02T21:05:56Z</dc:date>
    <item>
      <title>macro question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95269#M26966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all&lt;/P&gt;&lt;P&gt;i am trying to learn more about macros and&amp;nbsp; this below is the 1st problem i was doing:&lt;/P&gt;&lt;P&gt;When i run the code i do see in the logs that a data set gets created but it dont get the output so i figure it is something with the macro code but dont know what.&lt;/P&gt;&lt;P&gt;Also eventhough i have the mprint option i still dont see in the logs that the macro processor resolves the sas statements and&amp;nbsp; that is probabloy cuz something's wrong with the macro code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options mprint;&lt;/P&gt;&lt;P&gt;DATA orders;&lt;/P&gt;&lt;P&gt;INPUT CustomerID $ 1-3 OrderDate DATE7. Model $ 13-24 Quantity;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;287 15OCT03 Delta Breeze 15&lt;/P&gt;&lt;P&gt;287 15OCT03 Santa Ana&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;274 16OCT03 Jet Stream&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;174 17OCT03 Santa Ana&amp;nbsp;&amp;nbsp; 20&lt;/P&gt;&lt;P&gt;174 17OCT03 Nor'easter&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;174 17OCT03 Scirocco&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;347 18OCT03 Mistral&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;287 21OCT03 Delta Breeze30&lt;/P&gt;&lt;P&gt;287 21OCT03 Santa Ana&amp;nbsp;&amp;nbsp; 25&lt;/P&gt;&lt;P&gt;;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro reports;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysday=Monday %then proc print data=orders;&lt;/P&gt;&lt;P&gt;%else %if &amp;amp;sysdate=02apr13 %then %do;proc sort data=orders;by customerid; proc print data=orders; by customerid;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%reports&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 19:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95269#M26966</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-04-02T19:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: macro question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95270#M26967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are having semi-colon issues.&lt;/P&gt;&lt;P&gt;1) The semicolon after the first PROC PRINT will end the %THEN clause and not the proc print.&lt;/P&gt;&lt;P&gt;2) You need something to let SAS know that you are done specifying the inputs to the macro call.&amp;nbsp; So add a semi-colon to the line where %reports is executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also be careful in your comparisons.&amp;nbsp; Case matters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you get more consistent in your formatting you can avoid this confusion and also eliminate the randomly placed RUN; statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro reports;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %if (&amp;amp;sysday=Monday) %then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=orders;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %end;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %else %if (&amp;amp;sysdate9=02APR2013) %then %do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sort data=orders;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by customerid;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print data=orders;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by customerid;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%reports;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 19:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95270#M26967</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-04-02T19:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: macro question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95271#M26968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some things to check:&lt;/P&gt;&lt;P&gt;1. Comparisons are case sensitive so are the cases for sysday and sysdate the same as you'd see in the macro variables?&lt;/P&gt;&lt;P&gt;2. Rather than have any proc's in the then clauses you can add some %put statements to test your logic is flowing the way you want.&lt;/P&gt;&lt;P&gt;3. Add in another else to deal with when neither of the first two options are met, usually for error checking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tweak the code until you get what you expect then add in your procs. &lt;/P&gt;&lt;P&gt;Here's an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro reports;&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysday=Monday %then %put Monday Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%else %if &amp;amp;sysdate=02apr13 %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put Otherwise clause;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%else %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put WARNING: Other else clause - check code;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%reports;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 19:56:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95271#M26968</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-02T19:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: macro question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95272#M26969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so it turns that 02APR13 instead of 02apr13 made a big change.Is that what you mean by Comparisons are case sensitive?&lt;/P&gt;&lt;P&gt;cuz now with 02APR13 i see the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks guys&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Apr 2013 21:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95272#M26969</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-04-02T21:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: macro question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95273#M26970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes, case is important&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put note: SysDate &amp;amp;SysDate;&lt;/P&gt;&lt;P&gt;%put note: SysDate9 &amp;amp;SysDate9;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 14:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/macro-question/m-p/95273#M26970</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-04-03T14:31:01Z</dc:date>
    </item>
  </channel>
</rss>

