<?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: date comparison condition in a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116445#M24030</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first line must be&lt;/P&gt;&lt;P&gt;%LET &amp;amp;stichtag=20111230;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 May 2012 10:01:23 GMT</pubDate>
    <dc:creator>sfmeier</dc:creator>
    <dc:date>2012-05-16T10:01:23Z</dc:date>
    <item>
      <title>date comparison condition in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116444#M24029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 10pt; mso-fareast-language: DE;"&gt;I am trying to create a macro bibgen, that sets the macro variable bib to a, if the date stichdatum is earlier then 01Jan2012, else to b.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 10pt; mso-fareast-language: DE;"&gt;Stichdatum is a date macro variable that is created by the code &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 10pt; mso-fareast-language: DE;"&gt;--------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt; mso-fareast-language: DE;"&gt;%LET &lt;SPAN style="color: #000000;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #0000ff; font-size: 10pt; mso-fareast-language: DE;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; Stichdatum = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;(INPUTN(&amp;amp;stichtag, B8601DA.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;--------------------------------------------------------&lt;/P&gt;&lt;P class="MsoNormal"&gt;&lt;/P&gt;&lt;P class="MsoNormal"&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;Here is my macro, however it does not work. It always returns b, whereas it should return b in this case! How can I fix it?&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;--------------------------------------------------------&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;/* Makro zur automatischen Selektion der richtigen Bibliothek wg. Historisierung */&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;STRONG style="mso-fareast-language: DE; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;%Macro&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; bibgen();&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%GLOBAL&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; bib;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; stichdatum2 = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;(putn(&amp;amp;stichdatum, date9.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; stichdatum=&amp;amp;stichdatum;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; stichdatum2=&amp;amp;stichdatum2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%IF&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; &amp;amp;stichdatum &amp;lt; &lt;/SPAN&gt;&lt;STRONG style="mso-fareast-language: DE; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;'01Jan2012'd&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="mso-fareast-language: DE; background: white; font-size: 10pt; font-family: 'Courier New'; mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%THEN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; bib =a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="mso-fareast-language: DE; background: white; font-size: 10pt; font-family: 'Courier New'; mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%ELSE&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; bib =b;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; &amp;amp;bib;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;STRONG style="mso-fareast-language: DE; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 10pt; mso-fareast-language: DE;"&gt; bibGen;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 10:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116444#M24029</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2012-05-16T10:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: date comparison condition in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116445#M24030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first line must be&lt;/P&gt;&lt;P&gt;%LET &amp;amp;stichtag=20111230;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 10:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116445#M24030</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2012-05-16T10:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: date comparison condition in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116446#M24031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rather than writing the date as '01Jan2012'd, that will just be interpereated as text? Use this instead...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sysfunc(putn('01Jan2012'd,5.))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 10:26:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116446#M24031</guid>
      <dc:creator>PaulLee</dc:creator>
      <dc:date>2012-05-16T10:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: date comparison condition in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116447#M24032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! It works. However, just that I understand the reason: I always thought that SAS would evaluate the condition as sas code and not as macro code.&lt;/P&gt;&lt;P&gt;So would the condition be different in an regular IF-THEN-Clause? i.e.I could write '01Jan2012'd in a regular IF-THEN-Clause, coundn't I?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 10:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116447#M24032</guid>
      <dc:creator>sfmeier</dc:creator>
      <dc:date>2012-05-16T10:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: date comparison condition in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116448#M24033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use %SYSEVALF() to let the macro code evaluate the date comparisons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; background-color: white;"&gt;%IF&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; background-color: white;"&gt; %sysevalf(&amp;amp;stichdatum &amp;lt; &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt; font-family: 'Courier New'; background-color: white;"&gt;'01Jan2012'd)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 10:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/date-comparison-condition-in-a-macro/m-p/116448#M24033</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-05-16T10:58:32Z</dc:date>
    </item>
  </channel>
</rss>

