SAS Macro date inequalities
<p>Good morning,</p>

<p>This is a similar question to this one (<a href="https://stackoverflow.com/questions/31932269/sas-global-date-comparison/31932700">link</a>) but I am ideally looking for further explanation that I cannot find anywhere.</p>

<p>I was recently asked by a colleague why the the following inequalities return the results that they do:</p>

<pre><code>%MACRO  TEST ;

%IF '01JAN2009'D    &lt;   '01MAR2015'D    %THEN %PUT  1 is True ;
%ELSE %PUT  1 is False ;

%IF '01FEB2009'D    &lt;   '01MAR2015'D    %THEN %PUT  2 is True ;
%ELSE %PUT  2 is False ;

%IF '01SEP2009'D    &lt;   '01MAR2015'D    %THEN %PUT  3 is True ;
%ELSE %PUT  3 is False ;

%IF '01OCT2009'D    &lt;   '01MAR2015'D    %THEN %PUT  4 is True ;
%ELSE %PUT  4 is False ;

%MEND   TEST ;
%TEST ;
</code></pre>

<p>Running TEST returns:</p>

<pre><code>1 is True
2 is True
3 is False
4 is False
</code></pre>

<p>I understand that %SYSEVALF() is required to resolve these inequalities as expected.  However can anyone explain to me what SAS is doing in these four instances and why two return TRUE values, whilst two return FALSE?</p>