<?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: problem with if statement on dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problem-with-if-statement-on-dates/m-p/743477#M232792</link>
    <description>&lt;P&gt;The date value must be in one of the forms the DATE. format uses such as "30Apr2019"d.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are just too many random sequences of digits to provide all of them as date literal values, partially because some of them are just plain too ambiguous. Consider, what date would '01-02-03' mean?&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 05:30:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-05-25T05:30:03Z</dc:date>
    <item>
      <title>problem with if statement on dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-if-statement-on-dates/m-p/743476#M232791</link>
      <description>&lt;PRE&gt;data moomoo;
set moo;
if DATE= '2019-04-30'd	 then  dummy= 1;
run;&lt;/PRE&gt;
&lt;DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         data moomoo;
 74         set moo;
 75         if PORTFOLIO_DATE = '2019-04-30'd then  dummy= 1;
                                _____________
                                77
 ERROR: Invalid date/time/datetime constant '2019-04-30'd.
 ERROR 77-185: Invalid number conversion on '2019-04-30'd.
 
 77         run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.MOOMOO may be incomplete.  When this step was stopped there were 0 observations and 8 variables.
 WARNING: Data set WORK.MOOMOO was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 78         
 79         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 92     &lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE id="pre_sasLog_511" class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasprogramming_0-1621920181741.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59711i898EC80788CCDEFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sasprogramming_0-1621920181741.png" alt="sasprogramming_0-1621920181741.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasprogramming_1-1621920195757.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59712i98BC24F97632DE5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sasprogramming_1-1621920195757.png" alt="sasprogramming_1-1621920195757.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Why does the if statement not work? I have tried almost everything in regards to date formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 05:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-if-statement-on-dates/m-p/743476#M232791</guid>
      <dc:creator>sasprogramming</dc:creator>
      <dc:date>2021-05-25T05:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: problem with if statement on dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-if-statement-on-dates/m-p/743477#M232792</link>
      <description>&lt;P&gt;The date value must be in one of the forms the DATE. format uses such as "30Apr2019"d.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are just too many random sequences of digits to provide all of them as date literal values, partially because some of them are just plain too ambiguous. Consider, what date would '01-02-03' mean?&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 05:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-if-statement-on-dates/m-p/743477#M232792</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-25T05:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: problem with if statement on dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-if-statement-on-dates/m-p/743524#M232814</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;use&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'30Apr2019'd&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;mdy(04,30,2019)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 May 2021 11:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-if-statement-on-dates/m-p/743524#M232814</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-05-25T11:27:50Z</dc:date>
    </item>
  </channel>
</rss>

