<?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: Need SAS SQL to return the minimum date as date but not as number in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101360#M28461</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Shiva. It did helped. I too got it from some other related posts.&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Aug 2012 08:45:46 GMT</pubDate>
    <dc:creator>nitesh_k</dc:creator>
    <dc:date>2012-08-22T08:45:46Z</dc:date>
    <item>
      <title>Need SAS SQL to return the minimum date as date but not as number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101357#M28458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need help on SAS. Check below queries:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Query 1: SELECT Publication_Date FROM test(obs=1);&lt;/P&gt;&lt;P&gt;Output: 2000-04-23&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Query 2: SELECT MIN(Publication_Date) FROM test;&lt;/P&gt;&lt;P&gt;Output: 14723&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Publication_Date is of DATE type. I am using SAS 9.2 and testing above queries through JDBC layer and analyzing the resultset metadata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now for query 2, I need to get the output as SAS sql type Date but not as some NUMBER as in above case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Same query 2 in all other database vendors like oracle, MySql returns back the result in Date data type only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried below query but it doesn't solve my purpose. This query returns String but not DATE data type. &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT put(MIN(Publication_Date),yymmdd10.) FROM test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output: "2000-04-23"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 08:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101357#M28458</guid>
      <dc:creator>nitesh_k</dc:creator>
      <dc:date>2012-08-22T08:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need SAS SQL to return the minimum date as date but not as number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101358#M28459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this...Hope this helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;input Publication_Date:date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;01dec2012&lt;/P&gt;&lt;P&gt;01mar2012&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;SELECT MIN(Publication_Date) as date format=date9. FROM test;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 08:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101358#M28459</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-08-22T08:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need SAS SQL to return the minimum date as date but not as number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101359#M28460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got one solution. Thanks to "More like this" link which appears after we post the discussion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need to specify alias and format as below:&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 MIN(Publication_Date) as mindate format=Date9. FROM test;&lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 08:44:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101359#M28460</guid>
      <dc:creator>nitesh_k</dc:creator>
      <dc:date>2012-08-22T08:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need SAS SQL to return the minimum date as date but not as number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101360#M28461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Shiva. It did helped. I too got it from some other related posts.&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 08:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-SAS-SQL-to-return-the-minimum-date-as-date-but-not-as/m-p/101360#M28461</guid>
      <dc:creator>nitesh_k</dc:creator>
      <dc:date>2012-08-22T08:45:46Z</dc:date>
    </item>
  </channel>
</rss>

