<?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: How to apply a custom date format? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87566#M257121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure was an xclent example Bruno!&lt;/P&gt;&lt;P&gt;Highly do oblige your contribution!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Sep 2013 10:19:11 GMT</pubDate>
    <dc:creator>FarazA_Qureshi</dc:creator>
    <dc:date>2013-09-19T10:19:11Z</dc:date>
    <item>
      <title>How to apply a custom date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87563#M257118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In an SQL statement I need to have the results returning a custom date format of a field MIS_DATE as YYYY_MM in other words a date like 31JAN2013 being returned as &lt;STRONG&gt;2013_01&lt;/STRONG&gt;. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;A relevant change in this regard in the following statement shall be obliged:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE RESULTS3 AS SELECT MIS_DATE AS DATA_MONTH format = YYYY_MM. FROM FAQ;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The process runs well without any observation in the Log but when I double click the Results3 dataset the same doesnot open and only then comes up the entry in Log:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;ERROR: Format YYYY_MM not found or couldn't be loaded for variable DATA_MONTH.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanx in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2013 06:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87563#M257118</guid>
      <dc:creator>FarazA_Qureshi</dc:creator>
      <dc:date>2013-09-19T06:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a custom date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87564#M257119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See my post in your other thread...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2013 07:13:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87564#M257119</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-09-19T07:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a custom date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87565#M257120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS allows you to build custom date formats using Proc FORMAT, see an example below. Have a look at the doc for the PICTURE statement in Proc FORMAT for more information on other directives possible in a picture format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; have;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; month = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;12&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myDate = mdy(month, &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;, year(today()));&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;output&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;end&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; myDate &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;date9.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;format&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;picture&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x_yyyy_mm (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;default&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;7&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; low - high = &lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'%Y_%0m'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;datatype&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=date)&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;sql&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myDate&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , myDate &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; mydate2 format=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;yymmd.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; , myDate &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; mydate3 format=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;x_yyyy_mm.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; have&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2013 07:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87565#M257120</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2013-09-19T07:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a custom date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87566#M257121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure was an xclent example Bruno!&lt;/P&gt;&lt;P&gt;Highly do oblige your contribution!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2013 10:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87566#M257121</guid>
      <dc:creator>FarazA_Qureshi</dc:creator>
      <dc:date>2013-09-19T10:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply a custom date format?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87567#M257122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you just want the data as a character string (as opposed to a numeric date value with a particular display format attached to it) then you can build it easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;select catx('_',year(MIS_DATE),month(MIS_DATE)) as DATA_MONTH&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;or if you need 2013_01 instead of 2013_1 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;select catx('_',year(MIS_DATE),put(month(MIS_DATE),Z2.)) as DATA_MONTH&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2013 13:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-a-custom-date-format/m-p/87567#M257122</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-09-19T13:28:53Z</dc:date>
    </item>
  </channel>
</rss>

