<?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: SQL DATE GROUP BY help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329610#M73769</link>
    <description>&lt;P&gt;It is a DATETIME observation I'm pulling DATEPART from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to group the data by Month/Year based off the only date.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2017 21:51:19 GMT</pubDate>
    <dc:creator>G_I_Jeff</dc:creator>
    <dc:date>2017-02-02T21:51:19Z</dc:date>
    <item>
      <title>SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329595#M73763</link>
      <description>&lt;P&gt;I have the following code:&lt;/P&gt;
&lt;PRE&gt;PROC SQL;                                   
 SELECT SYSTEM,                             
        PUT(DATE,YYMMD7.) AS DATE,          
        ACCOUNT1,                           
        TYPETASK,                           
        SUM(CPUTOTTM) AS CPUSECS,           
        SUM(CPUZIPTM) AS ZIPSECS            
   FROM USER.TMPSMF                         
  WHERE TYPETASK IN ('JOB','TSU') AND       
        ACCOUNT1 IN ('HHS000V8',            
                     'PG83BAKT',            
                     'PVVABBKZ',            
                     'RF2JS4AR',            
                     'RGGS7PAA',            
                     'RGXP44AY',            
                     'THAFRCKC',            
                     'TJDBA6GA',            
                     'TJNCJLGF',            
                     'RM9ZYWLG')            
  GROUP BY SYSTEM, DATE, ACCOUNT1, TYPETASK;
QUIT;                                       
RUN;                                        &lt;/PRE&gt;
&lt;P&gt;I am trying to group by date in MMYYYY but it's not working and I don't understand why. I've tried several different formats. Do I need to set the format before I perform this SQL call?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 21:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329595#M73763</guid>
      <dc:creator>G_I_Jeff</dc:creator>
      <dc:date>2017-02-02T21:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329601#M73765</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19745"&gt;@G_I_Jeff&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;but it's not working and I don't understand why.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What does not working mean?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 21:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329601#M73765</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-02T21:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329605#M73766</link>
      <description>&lt;P&gt;Sorry Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're right. I forgot to pose my underlying question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not sorting the date as MMYYYY. Its still sorting as YYYYMMDD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 21:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329605#M73766</guid>
      <dc:creator>G_I_Jeff</dc:creator>
      <dc:date>2017-02-02T21:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329607#M73767</link>
      <description>&lt;P&gt;Describe not working, no result, unexpected result, error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, is your date actuall a SAS date value and not perhaps a DATETIME value? If your value is date time value then you would see results like ******* as you are trying to put the number seconds into a layout expecting numbers of days.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 21:43:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329607#M73767</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-02T21:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329610#M73769</link>
      <description>&lt;P&gt;It is a DATETIME observation I'm pulling DATEPART from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to group the data by Month/Year based off the only date.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 21:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329610#M73769</guid>
      <dc:creator>G_I_Jeff</dc:creator>
      <dc:date>2017-02-02T21:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329616#M73771</link>
      <description>&lt;P&gt;You must tell SAS which version of DATE you are talking about in your &lt;STRONG&gt;group by&lt;/STRONG&gt; clause. Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;                                   
 SELECT SYSTEM,                             
        PUT(DATE,YYMMD7.) AS DATE,          
        ACCOUNT1,                           
        TYPETASK,                           
        SUM(CPUTOTTM) AS CPUSECS,           
        SUM(CPUZIPTM) AS ZIPSECS            
   FROM USER.TMPSMF                         
  WHERE TYPETASK IN ('JOB','TSU') AND       
        ACCOUNT1 IN ('HHS000V8',            
                     'PG83BAKT',            
                     'PVVABBKZ',            
                     'RF2JS4AR',            
                     'RGGS7PAA',            
                     'RGXP44AY',            
                     'THAFRCKC',            
                     'TJDBA6GA',            
                     'TJNCJLGF',            
                     'RM9ZYWLG')            
  GROUP BY SYSTEM, calculated DATE, ACCOUNT1, TYPETASK;
QUIT;     &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Feb 2017 22:08:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329616#M73771</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-02T22:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329617#M73772</link>
      <description>&lt;P&gt;My PROC SQL is a bit rusty since I've been primarily working with explicit pass through SQL to Oracle, but try something like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like PG Stats suggested basically the same thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;                                   
 SELECT SYSTEM,                             
        PUT(DATE, mmyy7.) AS DATE,       
        ACCOUNT1,                           
        TYPETASK,                           
        SUM(CPUTOTTM) AS CPUSECS,           
        SUM(CPUZIPTM) AS ZIPSECS            
   FROM USER.TMPSMF                         
  WHERE TYPETASK IN ('JOB','TSU') AND       
        ACCOUNT1 IN ('HHS000V8',            
                     'PG83BAKT',            
                     'PVVABBKZ',            
                     'RF2JS4AR',            
                     'RGGS7PAA',            
                     'RGXP44AY',            
                     'THAFRCKC',            
                     'TJDBA6GA',            
                     'TJNCJLGF',            
                     'RM9ZYWLG')            
  GROUP BY SYSTEM, PUT(DATE, mmyy7.), ACCOUNT1, TYPETASK;
QUIT;        &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 22:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329617#M73772</guid>
      <dc:creator>Sven111</dc:creator>
      <dc:date>2017-02-02T22:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DATE GROUP BY help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329625#M73778</link>
      <description>&lt;P&gt;Thank you! I didn't realize you could/had to put the calculated function or the format in the actual GROUP statement. Now I know!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 22:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-DATE-GROUP-BY-help/m-p/329625#M73778</guid>
      <dc:creator>G_I_Jeff</dc:creator>
      <dc:date>2017-02-02T22:36:14Z</dc:date>
    </item>
  </channel>
</rss>

