<?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: Monthly Report Transpose in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577505#M163637</link>
    <description>thx...just had to sort first!!</description>
    <pubDate>Mon, 29 Jul 2019 19:44:44 GMT</pubDate>
    <dc:creator>BCNAV</dc:creator>
    <dc:date>2019-07-29T19:44:44Z</dc:date>
    <item>
      <title>Monthly Report Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577491#M163630</link>
      <description>&lt;P&gt;This is probably simple, but here goes.&amp;nbsp; Data is structured as monthly files...so each file has records from the days of a month.&amp;nbsp; It looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp; Market&amp;nbsp; &amp;nbsp;Revenue&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;July 1&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;July 1&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;July 2&amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;July 3&amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There can be many transactions per day over the month.&amp;nbsp; I'd like to make:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date and Market Revenue for each market in the horizontal, for each market.&amp;nbsp; Example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Date&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;July 1&amp;nbsp; &amp;nbsp;11&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;July 2&amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 4&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;July 3&amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, there is one date for a day, then the horizontal is the sum of each market's revenue (markets are 1,2,3, etc) for that day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 19:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577491#M163630</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2019-07-29T19:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Monthly Report Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577494#M163633</link>
      <description>&lt;P&gt;First, do a proc summary by date and market for variable revenue. Then do a transpose by date, id market and var revenue,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
by date market;
var revenue;
output
  out=summary (keep=date market revenue)
  sum(revenue)=revenue
;
run;

proc transpose data=summary out=want prefix=market_;
by date;
id market;
var revenue;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may have to tinker around a little with proc summary to only get the desired observations.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 19:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577494#M163633</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-29T19:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Monthly Report Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577505#M163637</link>
      <description>thx...just had to sort first!!</description>
      <pubDate>Mon, 29 Jul 2019 19:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577505#M163637</guid>
      <dc:creator>BCNAV</dc:creator>
      <dc:date>2019-07-29T19:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Monthly Report Transpose</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577520#M163645</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input Date &amp;amp; $10.      Market   Revenue;
cards;
July 1    1        5
July 1    1        6
July 2    2        4
July 3    3        6
;


/*Get the max of the market for sizing up the array elements*/
proc sql;
select max(market) into :m trimmed
from have;
quit;

data want;
if 0 then set have;
array market_(&amp;amp;m)(&amp;amp;m*0);
retain _k;
if _n_=1 then _k=peekclong(addrlong(market_(1)),&amp;amp;m*8);
do until(last.market);
set have;
by date market;
if first.market then call pokelong(_k,addrlong(market_(1)),&amp;amp;m*8);
_sum=sum(_sum,revenue);
end;
market_(market)=_sum;
keep date market_:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jul 2019 20:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Monthly-Report-Transpose/m-p/577520#M163645</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-29T20:17:20Z</dc:date>
    </item>
  </channel>
</rss>

