<?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: using datetime prompts in Case statement in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209228#M15652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the prompt has become a macro variable then use &amp;amp; before the name to resolve the name to the value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;amp;START_DATE_90&lt;/P&gt;&lt;P&gt;If it contains a datetime value in text format ( 21JUL2015:13:02 for example) then you can wrap it in quotes and append DT to let SAS know that you want it treated as a datetime literal.&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;amp;START_DATE_90"DT&lt;/P&gt;&lt;P&gt;If it contains the number of seconds since 01JAN1960 then do not wrap it in quotes as it will be a number.&lt;/P&gt;&lt;P&gt;If you are comparing the value to variables that contain dates then you might need to convert it from datetime to date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATEPART("&amp;amp;START_DATE_90"DT)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jul 2015 20:06:56 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-07-22T20:06:56Z</dc:date>
    <item>
      <title>using datetime prompts in Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209226#M15650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;hello after creating a new computed column based on the advice of the earlier discussion&lt;/P&gt;&lt;P&gt;case&amp;nbsp; when ( t1.date &amp;lt;=&amp;nbsp; "start_date_90"d then 1&amp;nbsp; else 0 end&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get a invalid date/time/datetime constat "start_date_90"d.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i use the prompt in a filter statement the code reflects no error.&lt;/P&gt;&lt;P&gt;what is happening.&amp;nbsp; am I missing something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 19:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209226#M15650</guid>
      <dc:creator>psarathy</dc:creator>
      <dc:date>2015-07-22T19:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: using datetime prompts in Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209227#M15651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is start_date_90? A variable or prompt?&lt;/P&gt;&lt;P&gt;If it's a prompt in date time format use it as &amp;amp;start_date_90 - no quotes and no d.&lt;/P&gt;&lt;P&gt;If it's a variable use start_date_90 - no quotes, no d.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quotes and D are for when you're hard coding a date comparison.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 19:56:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209227#M15651</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-22T19:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: using datetime prompts in Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209228#M15652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the prompt has become a macro variable then use &amp;amp; before the name to resolve the name to the value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;amp;START_DATE_90&lt;/P&gt;&lt;P&gt;If it contains a datetime value in text format ( 21JUL2015:13:02 for example) then you can wrap it in quotes and append DT to let SAS know that you want it treated as a datetime literal.&lt;/P&gt;&lt;P&gt;&amp;nbsp; "&amp;amp;START_DATE_90"DT&lt;/P&gt;&lt;P&gt;If it contains the number of seconds since 01JAN1960 then do not wrap it in quotes as it will be a number.&lt;/P&gt;&lt;P&gt;If you are comparing the value to variables that contain dates then you might need to convert it from datetime to date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATEPART("&amp;amp;START_DATE_90"DT)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 20:06:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209228#M15652</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-22T20:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: using datetime prompts in Case statement</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209229#M15653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Tom and Reeza,&lt;/P&gt;&lt;P&gt;apologies... I did use the "&amp;amp;promptvar"dt&amp;nbsp;&amp;nbsp; the datetime variable is a sas datetime.&amp;nbsp; so I was hoping the " " and dt would do the trick.. Is this case sensitive?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok I tried all the suggestions. I think that using DT instead of D was the game changer.&lt;/P&gt;&lt;P&gt;"&amp;amp;start_date_90"DT&amp;nbsp; &amp;lt;+ t1.datvar&lt;/P&gt;&lt;P&gt;thanks a lot! it is running !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2015 21:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/using-datetime-prompts-in-Case-statement/m-p/209229#M15653</guid>
      <dc:creator>psarathy</dc:creator>
      <dc:date>2015-07-22T21:14:38Z</dc:date>
    </item>
  </channel>
</rss>

