<?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: Invalid date/time/datetime constant classification in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547913#M151881</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222221"&gt;@moseland&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to create a filtered output table from a previous table in my library. I am getting the following errors in the log when I run the code. I'm trying to filter only the observations where&amp;nbsp;&lt;SPAN style="text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: &amp;quot;HelevticaNeue-light&amp;quot;,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; float: none; display: inline !important; white-space: normal; cursor: text; orphans: 2; background-color: transparent; -webkit-text-stroke-width: 0px;"&gt;APPT_DATE&lt;/SPAN&gt; is after August 14, 2014. The original APPT_DATE has the DATETIME format:&amp;nbsp;5/25/2014 8:30&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The value you show looks very much like you copied from an Excel spreadsheet or perhaps an Access data table.&lt;/P&gt;
&lt;P&gt;You also should show us the results for Proc Contents for the variable APPT_DATE&amp;nbsp;from the data set CHOP.VISIT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on how you brought the data into SAS the value may not even be a datetime value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates and such.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2019 14:40:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-04-02T14:40:10Z</dc:date>
    <item>
      <title>Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547794#M151847</link>
      <description>&lt;P&gt;I am trying to create a filtered output table from a previous table in my library. I am getting the following errors in the log when I run the code. I'm trying to filter only the observations where&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;APPT_DATE&lt;/SPAN&gt; is after August 14, 2014. The original APPT_DATE has the DATETIME format:&amp;nbsp;5/25/2014 8:30&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;65 DATA chop.part1;&lt;BR /&gt;66 set chop.visit;&lt;BR /&gt;67 where DICT_ENC_TYPE_KEY = '83'&lt;BR /&gt;68 AND APPT_DATE &amp;gt;= "14082014:00:00"dt&lt;BR /&gt;ERROR: Invalid date/time/datetime constant "15082014:00:00"dt.&lt;BR /&gt;69 AND AGE BETWEEN 1 AND 19;&lt;BR /&gt;ERROR: Syntax error while parsing WHERE clause.&lt;BR /&gt;70 run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe the error is how I'm writing the datetime in line 68 but am unsure how to correctly input it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 02:40:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547794#M151847</guid>
      <dc:creator>moseland</dc:creator>
      <dc:date>2019-04-02T02:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547797#M151850</link>
      <description>&lt;P&gt;dt strings must be in format&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;'01jan2018:00:00:00'dt&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 03:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547797#M151850</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-02T03:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547820#M151856</link>
      <description>&lt;P&gt;See here for the documentation of SAS constants(literals):&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=p0cq7f0icfjr8vn19vyunwmmsl7m.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=p0cq7f0icfjr8vn19vyunwmmsl7m.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 07:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547820#M151856</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-02T07:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547913#M151881</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/222221"&gt;@moseland&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to create a filtered output table from a previous table in my library. I am getting the following errors in the log when I run the code. I'm trying to filter only the observations where&amp;nbsp;&lt;SPAN style="text-align: left; color: rgb(51, 51, 51); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: &amp;quot;HelevticaNeue-light&amp;quot;,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; float: none; display: inline !important; white-space: normal; cursor: text; orphans: 2; background-color: transparent; -webkit-text-stroke-width: 0px;"&gt;APPT_DATE&lt;/SPAN&gt; is after August 14, 2014. The original APPT_DATE has the DATETIME format:&amp;nbsp;5/25/2014 8:30&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The value you show looks very much like you copied from an Excel spreadsheet or perhaps an Access data table.&lt;/P&gt;
&lt;P&gt;You also should show us the results for Proc Contents for the variable APPT_DATE&amp;nbsp;from the data set CHOP.VISIT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on how you brought the data into SAS the value may not even be a datetime value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt; has a PDF with much information about dates and such.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 14:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/547913#M151881</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-02T14:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548094#M151961</link>
      <description>&lt;P&gt;I think you're right in that the Datetime format I originally included looks off. While the&amp;nbsp;&lt;SPAN&gt;5/25/2014 8:30 date was how it looked in an original .csv, it's possible I incorrectly imported the .csv into SAS in the first place. When I look at the PROC CONTENTS, this APPT_DT column is now:&amp;nbsp;APPT_DT Char 16 $16. $16.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since I need to specify a range I'll read up on how to correctly import dates into SAS. Thank you for this insight!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 02:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548094#M151961</guid>
      <dc:creator>moseland</dc:creator>
      <dc:date>2019-04-03T02:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548112#M151965</link>
      <description>&lt;P&gt;You can fix your problem at the source by converting the string in the step that reads the csv:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile datalines dlm=',' dsd;
input id $ _appt_dt :$16.;
appt_dt = dhms(input(scan(_appt_dt,1,' '),mmddyy10.),0,0,input(scan(_appt_dt,2,' '),time8.));
format appt_dt e8601dt19.;
datalines;
A,5/25/2014 8:30
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2019 06:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548112#M151965</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-03T06:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548163#M151983</link>
      <description>&lt;P&gt;Or something like (untested)&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; WANT&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;  infile&lt;/SPAN&gt; datalines dlm&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;', '&lt;/SPAN&gt; dsd&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;  input&lt;/SPAN&gt; ID &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; DATE :ddmmyy&lt;SPAN class="token punctuation"&gt;. TIME time.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  DTM &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;DATE*3600*24 + TIME;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;  format&lt;/SPAN&gt; DTM e8601dt19&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;datalines&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;
A,5/25/2014 8:30&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, all lower-case code is harder to read. My personal preference is to have user-defined names in uppercase and language keywords in lower case.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 11:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548163#M151983</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-03T11:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid date/time/datetime constant classification</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548189#M151996</link>
      <description>&lt;P&gt;I use the upper/lowercase distinction for something different: Variables pulled from the production database are uppercase, those created in the data warehouse during or after ETL are lowercase.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 12:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-date-time-datetime-constant-classification/m-p/548189#M151996</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-03T12:45:34Z</dc:date>
    </item>
  </channel>
</rss>

