<?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 Column to row and count in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/311434#M67300</link>
    <description>&lt;P&gt;I have a dataset with 6 million records with 40 measures. My dataset looks like:&lt;/P&gt;&lt;P&gt;state provider measure&lt;BR /&gt;FL AAA A&lt;BR /&gt;FL AAA A&lt;BR /&gt;FL AAA A&lt;BR /&gt;FL AAA B&lt;BR /&gt;FL AAA B&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL BBB A&lt;BR /&gt;FL BBB B&lt;BR /&gt;FL BBB C&lt;BR /&gt;FL BBB C&lt;BR /&gt;FL BBB C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want count for the measure.&amp;nbsp;My output must look like this&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;IMG title="Capture.PNG" alt="Capture.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/5843iD160CA97DEABD250/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2016 15:14:50 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2016-11-14T15:14:50Z</dc:date>
    <item>
      <title>Column to row and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/311434#M67300</link>
      <description>&lt;P&gt;I have a dataset with 6 million records with 40 measures. My dataset looks like:&lt;/P&gt;&lt;P&gt;state provider measure&lt;BR /&gt;FL AAA A&lt;BR /&gt;FL AAA A&lt;BR /&gt;FL AAA A&lt;BR /&gt;FL AAA B&lt;BR /&gt;FL AAA B&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL AAA c&lt;BR /&gt;FL BBB A&lt;BR /&gt;FL BBB B&lt;BR /&gt;FL BBB C&lt;BR /&gt;FL BBB C&lt;BR /&gt;FL BBB C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want count for the measure.&amp;nbsp;My output must look like this&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;IMG title="Capture.PNG" alt="Capture.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/5843iD160CA97DEABD250/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 15:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/311434#M67300</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2016-11-14T15:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Column to row and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/311439#M67302</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
infile datalines;
input state $ provider $ measure $;
datalines;
FL AAA A
FL AAA A
FL AAA A
FL AAA B
FL AAA B
FL AAA C
FL AAA C
FL AAA C
FL AAA C
FL BBB A
FL BBB B
FL BBB C
FL BBB C
FL BBB C
;
run;

proc sort data=have;
by state provider measure;
run;

data have_int;
set have;
by state provider measure;

retain val val_tot;

if first.measure then val=1;
else val=val+1;

if first.provider then val_tot=1;
else val_tot=val_tot+1;

if last.measure then output;
if last.provider then do;val=val_tot;measure='Total';output;end;


run;

proc transpose data=have_int out=want(drop=_name_);
by state provider;
var val;
id measure;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Nov 2016 15:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/311439#M67302</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-11-14T15:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Column to row and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/311443#M67306</link>
      <description>&lt;P&gt;This is untested, but should be in the ballpark:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc tabulate data=have;&lt;/P&gt;
&lt;P&gt;class state provider measure;&lt;/P&gt;
&lt;P&gt;tables state*provider, measure all;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 15:56:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/311443#M67306</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-11-14T15:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Column to row and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/312132#M67647</link>
      <description>&lt;P&gt;Do you want a row total for each state or just overall (across all states)? Since your example data only inclues one value for State is not clear what the summary row represents.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2016 22:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/312132#M67647</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-11-16T22:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Column to row and count</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/319551#M70220</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/33792"&gt;@Loko&lt;/a&gt;&lt;BR /&gt;This is helpful.</description>
      <pubDate>Fri, 16 Dec 2016 14:32:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Column-to-row-and-count/m-p/319551#M70220</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2016-12-16T14:32:14Z</dc:date>
    </item>
  </channel>
</rss>

