<?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: Simple Query distinct not working with date variable? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Simple-Query-distinct-not-working-with-date-variable/m-p/228311#M16634</link>
    <description>&lt;P&gt;If your date field is a SAS date, it may contain a fractional part, try using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE TABLE WORK.Stuff AS
SELECT DISTINCT round(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if your date field is a SAS datetime, it may contain a time value, try using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE TABLE WORK.Stuff AS
SELECT DISTINCT datepart(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Oct 2015 03:28:20 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2015-10-03T03:28:20Z</dc:date>
    <item>
      <title>Simple Query distinct not working with date variable?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Simple-Query-distinct-not-working-with-date-variable/m-p/228309#M16633</link>
      <description>&lt;P&gt;I've got a dataset containing a date field named Submitted:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;01Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;01Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;01Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;02Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366ff"&gt;03Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm&amp;nbsp;running a simple query builder which produces this code:&lt;/P&gt;
&lt;P&gt;PROC&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#000080" size="3" face="Courier New"&gt;&lt;FONT color="#000080" size="3" face="Courier New"&gt;&lt;FONT color="#000080" size="3" face="Courier New"&gt;SQL&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT size="3" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;CREATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;TABLE&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT size="3" face="Courier New"&gt; WORK.Stuff &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;AS&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;SELECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;DISTINCT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT size="3" face="Courier New"&gt; t1.Submitted&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;FROM&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT size="3" face="Courier New"&gt; WORK.INPUTSET t1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;ORDER&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;&lt;FONT color="#0000ff" size="3" face="Courier New"&gt;BY&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT size="3" face="Courier New"&gt; t1.Submitted;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;QUIT;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output result is:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;01Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;01Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;01Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;02Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;03Jan2015&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Shouldn't there only be three records in the output file?&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2015 03:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Simple-Query-distinct-not-working-with-date-variable/m-p/228309#M16633</guid>
      <dc:creator>SciFiGuy0</dc:creator>
      <dc:date>2015-10-03T03:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Query distinct not working with date variable?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Simple-Query-distinct-not-working-with-date-variable/m-p/228311#M16634</link>
      <description>&lt;P&gt;If your date field is a SAS date, it may contain a fractional part, try using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE TABLE WORK.Stuff AS
SELECT DISTINCT round(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if your date field is a SAS datetime, it may contain a time value, try using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE TABLE WORK.Stuff AS
SELECT DISTINCT datepart(t1.Submitted) as Submitted format=date9.
FROM WORK.INPUTSET t1
ORDER BY Submitted;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2015 03:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Simple-Query-distinct-not-working-with-date-variable/m-p/228311#M16634</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-03T03:28:20Z</dc:date>
    </item>
  </channel>
</rss>

