<?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: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918752#M361910</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;The most recent docu for SAS9.4&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p1ugvn0mocff92n13mw9s56300jv.htm#n10bbl1njzm9nrn1peo15mqcu551" target="_self"&gt;Date, Time, and Datetime Constants&lt;/A&gt; allows for the following string patterns.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1709507212249.png" style="width: 740px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94326i86D4941FCC7CE5FE/image-dimensions/740x309?v=v2" width="740" height="309" role="button" title="Patrick_0-1709507212249.png" alt="Patrick_0-1709507212249.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Mar 2024 23:07:20 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-03-03T23:07:20Z</dc:date>
    <item>
      <title>Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918730#M361904</link>
      <description>&lt;P&gt;Hi! Below is an excerpt of my data step. I am trying to write if-then logic such that if a particular condition is met (in this case if there is a particular record ID, then the variable, qi100d is a particular date:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data four; 
set three; 
if record_id="CABA010" then 
qi100a=upcase(redcap_data_access_group)
and qi100b="C-ABA-DQQ-000001" 
and qi100d="2-22-2024"d&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, SAS detects an error for this excerpt. The errors are as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;464  data four;
465  set three;
466  if record_id="CABA010" then
467  qi100a=upcase(redcap_data_access_group)
468  and qi100b="C-ABA-DQQ-000001"
469  and qi100d="2-22-2024"d
                ------------
                77
ERROR: Invalid date/time/datetime constant "2-22-2024"d.
ERROR 77-185: Invalid number conversion on "2-22-2024"d.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a particular reason why this error is popping up? Any input regarding this would be much appreciated; thanks so much!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2024 11:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918730#M361904</guid>
      <dc:creator>JackZ295</dc:creator>
      <dc:date>2024-03-03T11:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918732#M361905</link>
      <description>&lt;PRE&gt;469  and qi100d="2-22-2024"d
                ------------
                77
ERROR: Invalid date/time/datetime constant "2-22-2024"d.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not a format issue. It is, as stated in the ERROR message, an invalid date/time/datetime constant. A valid date constant for Feb 22, 2024 is '22FEB2024'd, exactly like that, no changes allowed, except FEB can be lower case. It can't have dashes or slashes or blanks, it must be as I just described, with a two digit day of month, followed by a three character month, followed by a 4 digit year.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2024 12:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918732#M361905</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-03-03T12:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918734#M361906</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/213376"&gt;@JackZ295&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition to the invalid date literal to be corrected, the three assignment statements must be enclosed in a DO-END block, not connected with AND.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if record_id="CABA010" then do;
  qi100a=upcase(redcap_data_access_group);
  qi100b="C-ABA-DQQ-000001";
  qi100d="22FEB2024"d;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;: Blanks and various special characters &lt;EM&gt;are&lt;/EM&gt; allowed in a date literal (albeit not recommended), even text following the year component.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;705   data _null_;
706   d1='***1\_.~^~._/Jan:-)24==&amp;gt;Happy New Year!'d;
707   put d1;
708   d2='01JAN2024'd;
709   put d2;
710   run;

23376
23376
NOTE: DATA statement used (Total process time):&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;</description>
      <pubDate>Sun, 03 Mar 2024 13:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918734#M361906</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-03-03T13:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918740#M361908</link>
      <description>&lt;P&gt;A quick search found this help page for date constant syntax.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_048/proccas/p14t12jhqk5yzmn11oewj4c1ehh2.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/v_048/proccas/p14t12jhqk5yzmn11oewj4c1ehh2.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Testing the examples on that page:&lt;/P&gt;
&lt;PRE&gt;1    data test;
2      date1='1jan2018'D;
3      date2="01jan18"D;
4      time1='9:25'T;
5      time2="9:25:19pm"T;
6      dt1='01may18:9:30:00'DT;
7      dt2="18jan2018:9:27:05am"DT;
8      dt3='2018-07-20T12:00:00Z'DT;
9      dt3='2018-05-17T09:15:30-05:00'DT;
10     format date: date9. time: tod8. dt: datetime19.;
11     put (_all_) (=/);
12   run;


date1=01JAN2018
date2=01JAN2018
time1=09:25:00
time2=21:25:19
dt1=01MAY2018:09:30:00
dt2=18JAN2018:09:27:05
dt3=17MAY2018:09:15:30
NOTE: The data set WORK.TEST has 1 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 Mar 2024 17:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918740#M361908</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-03T17:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918743#M361909</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;: Blanks and various special characters &lt;EM&gt;are&lt;/EM&gt; allowed in a date literal (albeit not recommended), even text following the year component.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;705   data _null_;
706   d1='***1\_.~^~._/Jan:-)24==&amp;gt;Happy New Year!'d;
707   put d1;
708   d2='01JAN2024'd;
709   put d2;
710   run;

23376
23376
NOTE: DATA statement used (Total process time):&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'll go further than "not recommended". The documentation doesn't say this is allowed, so it is undocumented and could stop working in the next release or next hot-fix, and thus it is unwise to use. &lt;A href="https://documentation.sas.com/doc/en/lrcon/9.4/p0cq7f0icfjr8vn19vyunwmmsl7m.htm#n1bbnuc86c5c5hn113qbpt5u9g5f" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/lrcon/9.4/p0cq7f0icfjr8vn19vyunwmmsl7m.htm#n1bbnuc86c5c5hn113qbpt5u9g5f&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2024 20:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918743#M361909</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-03-03T20:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918752#M361910</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;The most recent docu for SAS9.4&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p1ugvn0mocff92n13mw9s56300jv.htm#n10bbl1njzm9nrn1peo15mqcu551" target="_self"&gt;Date, Time, and Datetime Constants&lt;/A&gt; allows for the following string patterns.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1709507212249.png" style="width: 740px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94326i86D4941FCC7CE5FE/image-dimensions/740x309?v=v2" width="740" height="309" role="button" title="Patrick_0-1709507212249.png" alt="Patrick_0-1709507212249.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2024 23:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918752#M361910</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-03-03T23:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918755#M361911</link>
      <description>&lt;P&gt;The way I normally explain it is that the string inside the quotes has to be something the DATE informat can read.&amp;nbsp; &amp;nbsp;The DATE11. informat can handle pretty much any valid delimiter between the parts of the string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reality is that is actually excepts more than that.&amp;nbsp; Kind of like how the COMMA informat will ignore any number of commas.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 00:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918755#M361911</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-04T00:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Question With Utilizing Date Format in Data Step- Error (Invalid Date/Invalid # Conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918764#M361913</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if record_id="CABA010" then 
qi100a=upcase(redcap_data_access_group) /* you start an assignment here */
and qi100b="C-ABA-DQQ-000001" /* these AND is part of the assignment, so it makes the result of the whole assignment boolean */
and qi100d="2-22-2024"d&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you really want this?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 07:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-With-Utilizing-Date-Format-in-Data-Step-Error-Invalid/m-p/918764#M361913</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-04T07:55:19Z</dc:date>
    </item>
  </channel>
</rss>

