<?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: Date field - creating in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224828#M16498</link>
    <description>&lt;P&gt;You probably want to use a date (or as in your example a datetime) literal. If you want a DATE then use '01MAY2015'D if you want a DATETIME value then use '01MAY2015:00:00:00'DT. You could also use a function call such as MDY(5,1,2015). You should also attach a format to the variable so the value will be displayed properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL; &lt;BR /&gt;  CREATE TABLE WANT AS &lt;BR /&gt;    SELECT *&lt;BR /&gt;         , CASE WHEN t1.year = 24 THEN '01MAY2015:00:00:00'dt&lt;BR /&gt;          END AS DATETIME FORMAT=DATETIME20.&lt;BR /&gt;    FROM HAVE&lt;BR /&gt;  ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2015 20:02:11 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-09-09T20:02:11Z</dc:date>
    <item>
      <title>Date field - creating</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224826#M16497</link>
      <description>&lt;P&gt;How do I create a date field with a value using a CASE WHEN statement?&amp;nbsp; Here is my statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CASE WHEN t1.year = 24 then '01MAY2015:00:00:00'&lt;/P&gt;
&lt;P&gt;END&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 19:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224826#M16497</guid>
      <dc:creator>carmendee</dc:creator>
      <dc:date>2015-09-09T19:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date field - creating</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224828#M16498</link>
      <description>&lt;P&gt;You probably want to use a date (or as in your example a datetime) literal. If you want a DATE then use '01MAY2015'D if you want a DATETIME value then use '01MAY2015:00:00:00'DT. You could also use a function call such as MDY(5,1,2015). You should also attach a format to the variable so the value will be displayed properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC SQL; &lt;BR /&gt;  CREATE TABLE WANT AS &lt;BR /&gt;    SELECT *&lt;BR /&gt;         , CASE WHEN t1.year = 24 THEN '01MAY2015:00:00:00'dt&lt;BR /&gt;          END AS DATETIME FORMAT=DATETIME20.&lt;BR /&gt;    FROM HAVE&lt;BR /&gt;  ;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 20:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224828#M16498</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-09-09T20:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date field - creating</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224832#M16499</link>
      <description>Problem - the date returned is today's date.  Statement:&lt;BR /&gt;CASE WHEN t1.SCHOOL_YEAR_ID = 18 THEN DATETIME('01MAY2015:00:00:00'DT)&lt;BR /&gt;END</description>
      <pubDate>Wed, 09 Sep 2015 20:01:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224832#M16499</guid>
      <dc:creator>carmendee</dc:creator>
      <dc:date>2015-09-09T20:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date field - creating</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224833#M16500</link>
      <description>&lt;P&gt;DATETIME() function just returns the current date time. &amp;nbsp;Use just the literal or another function such as INPUTN().&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 20:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224833#M16500</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-09-09T20:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Date field - creating</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224835#M16501</link>
      <description>Oops.  Removed my DATETIME and reran.  Thanks Tom.</description>
      <pubDate>Wed, 09 Sep 2015 20:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-field-creating/m-p/224835#M16501</guid>
      <dc:creator>carmendee</dc:creator>
      <dc:date>2015-09-09T20:05:21Z</dc:date>
    </item>
  </channel>
</rss>

