<?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 do a summary for the totals for each quarter and send output to Excel? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650884#M195210</link>
    <description>&lt;P&gt;If you are going to ask a bunch of related questions you really should provide an example data set we can work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted&lt;STRONG&gt; into a forum code box using the &amp;lt;/&amp;gt; icon&lt;/STRONG&gt; or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2020 18:53:41 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-05-26T18:53:41Z</dc:date>
    <item>
      <title>How to do a summary for the totals for each quarter and send output to Excel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650854#M195198</link>
      <description>&lt;P&gt;So, I'm looking to do a summary of a dataset using proc tabulate to get totals for the visitcount and payment variables for each quarter. I also want it so that my output is sent directly to excel. How can I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table statesums as
select count(pkey) as visitcount, state,
date, code, sum(dis) as payment
from medcla
where state in ('NY','PA','NJ')
group by state, date, code;
quit;

proc sort data = statesums; 
by state code; run;

proc transpose data = statesums out=visits prefix=visitcount;
var visitcount; id date; by =state hcpcs;
run;

proc transpose data = statesums out=payments prefix=dollars;
var payment; id date; by state code;
run;

proc sql;
create table totals as
select * from vists as x left join payments as y
on x.state = y.state
and x.code = y.code;
quit;



&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 26 May 2020 17:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650854#M195198</guid>
      <dc:creator>SM8</dc:creator>
      <dc:date>2020-05-26T17:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a summary for the totals for each quarter and send output to Excel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650862#M195202</link>
      <description>&lt;P&gt;Can you show us what the output ought to look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Honestly, I don't think any of your code is needed, PROC REPORT ought to produce the table directly from the original data.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 17:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650862#M195202</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-05-26T17:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a summary for the totals for each quarter and send output to Excel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650884#M195210</link>
      <description>&lt;P&gt;If you are going to ask a bunch of related questions you really should provide an example data set we can work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted&lt;STRONG&gt; into a forum code box using the &amp;lt;/&amp;gt; icon&lt;/STRONG&gt; or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 18:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650884#M195210</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-26T18:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a summary for the totals for each quarter and send output to Excel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650902#M195218</link>
      <description>&lt;P&gt;No idea how your code relates to your question, here's how I'd do it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="/folders/myfolders/demo.xlsx" style=meadow;

proc tabulate data=sashelp.stocks;
class stock date;
format date yyq6.;
var open;
table date*stock, open*MIN open*MAX;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299741"&gt;@SM8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So, I'm looking to do a summary of a dataset using proc tabulate to get totals for the visitcount and payment variables for each quarter. I also want it so that my output is sent directly to excel. How can I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table statesums as
select count(pkey) as visitcount, state,
date, code, sum(dis) as payment
from medcla
where state in ('NY','PA','NJ')
group by state, date, code;
quit;

proc sort data = statesums; 
by state code; run;

proc transpose data = statesums out=visits prefix=visitcount;
var visitcount; id date; by =state hcpcs;
run;

proc transpose data = statesums out=payments prefix=dollars;
var payment; id date; by state code;
run;

proc sql;
create table totals as
select * from vists as x left join payments as y
on x.state = y.state
and x.code = y.code;
quit;



&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 19:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-summary-for-the-totals-for-each-quarter-and-send/m-p/650902#M195218</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-26T19:27:59Z</dc:date>
    </item>
  </channel>
</rss>

