<?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: Proc SQL RollUps in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636219#M188991</link>
    <description>Awesome.  Much simpler than Proc SQL (with no Rollup functionality).  Thanks so much for taking the time to with this.  I appreciate it very much!</description>
    <pubDate>Tue, 31 Mar 2020 13:14:00 GMT</pubDate>
    <dc:creator>buechler66</dc:creator>
    <dc:date>2020-03-31T13:14:00Z</dc:date>
    <item>
      <title>Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636189#M188971</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; I have the following Proc SQL that sums variables at the active_description level.&amp;nbsp; Is there a way to also get an overall activity_description total by pay_data_month in the same query?&amp;nbsp; I seem to remember SQL has some sort up roll up functionality.&amp;nbsp; File attachment shows the current output.&amp;nbsp; So the desired output would have an additional row after each grouping of pay_data_month with a sub total for all activities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help here would be great.&amp;nbsp; Thanks so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE &amp;amp;SITE._HCR_PD_ACTVTY_SUM AS
SELECT PAY_DATA_MONTH
		, AREA
		, HCRID
		, ACTIVITY_DESCRIPTION
		, SUM(PAY_AMOUNT) FORMAT DOLLAR15.2 AS MNTHLY_PAY_AMNT
		, SUM(RATE) AS MNTHLY_RATE
		, SUM(UNITS) FORMAT 15.2 AS MNTHLY_UNITS
FROM &amp;amp;SITE._HCR_PD
WHERE HCRID='65036'
GROUP BY PAY_DATA_MONTH
		,AREA
		,HCRID
		,ACTIVITY_DESCRIPTION
;QUIT;&lt;BR /&gt;&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636189#M188971</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2020-03-31T12:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636191#M188972</link>
      <description>&lt;P&gt;All aggregate functions like sum() will be based on your grouping. You can't have different aggregation levels using a single Group By statement.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636191#M188972</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-31T12:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636192#M188973</link>
      <description>&lt;P&gt;Hmm, could you share the syntax for doing it in a single sas step?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636192#M188973</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2020-03-31T12:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636193#M188974</link>
      <description>&lt;P&gt;This type of summing over multiple different groupings is very easy in one call to PROC SUMMARY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=&amp;amp;SITE._HCR_PD(where=(HCRID='65036'));
     class pay_data_month area hcrid activity_description;
     types pay_data_month pay_data_month*area*hcrid*activity_description;
     var pay_amount rate units;
     output out=_sums_ sum=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:13:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636193#M188974</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-31T12:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636195#M188976</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hmm, could you share the syntax for doing it in a single sas step?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now you were faster than me deleting this comment from my post. It still would require two passes through the data as I guess you would want the "totals" added to all the rows with the sub-totals. So yes, one could have it in a single datastep using some "DOW" processing - but still two passes through the data.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636195#M188976</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-31T12:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636206#M188984</link>
      <description>Wow that's very cool.  Would that be able to be altered to also get a grand total across all months?</description>
      <pubDate>Tue, 31 Mar 2020 12:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636206#M188984</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2020-03-31T12:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636207#M188985</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/79805"&gt;@buechler66&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Wow that's very cool. Would that be able to be altered to also get a grand total across all months?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;types () pay_data_month pay_data_month*area*hcrid*activity_description;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Mar 2020 12:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636207#M188985</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-31T12:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL RollUps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636219#M188991</link>
      <description>Awesome.  Much simpler than Proc SQL (with no Rollup functionality).  Thanks so much for taking the time to with this.  I appreciate it very much!</description>
      <pubDate>Tue, 31 Mar 2020 13:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-RollUps/m-p/636219#M188991</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2020-03-31T13:14:00Z</dc:date>
    </item>
  </channel>
</rss>

