<?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: Count of data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702073#M215024</link>
    <description>Use PROC FREQ - which is the most basic solution.&lt;BR /&gt;&lt;BR /&gt;PROC FREQ data=abc;&lt;BR /&gt;table dsc;&lt;BR /&gt;run;</description>
    <pubDate>Fri, 27 Nov 2020 17:23:47 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-11-27T17:23:47Z</dc:date>
    <item>
      <title>Count of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702052#M215014</link>
      <description>&lt;P&gt;Hi Reader,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some new understanding i am exploring, so could you please share the solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Input data*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data abc ;&lt;BR /&gt;input dsc $ ;&lt;BR /&gt;cards;&lt;BR /&gt;a&lt;BR /&gt;a&lt;BR /&gt;c&lt;BR /&gt;b&lt;BR /&gt;b&lt;BR /&gt;b&lt;BR /&gt;b&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Output requirement*/&lt;/P&gt;
&lt;DIV id="tinyMceEditorpdhokriya_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="tinyMceEditorpdhokriya_1" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="29px"&gt;b&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;c&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;a&lt;/TD&gt;
&lt;TD width="25%" height="29px"&gt;total count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="28px"&gt;(n=4)&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;(n=1)&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;(n=2)&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;(n=7)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 16:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702052#M215014</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2020-11-27T16:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Count of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702053#M215015</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data abc ;
input dsc $ ;
cards;
a
a
c
b
b
b
b
;
run;

proc sql;
 create table temp as
 select dsc, count(dsc) as count, (select count( dsc )  from abc) as total_count
 from abc
 group by dsc;
quit;
proc transpose data=temp out=want(drop=_:);
 by total_count;
 var count;
 id dsc;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Nov 2020 16:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702053#M215015</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-11-27T16:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Count of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702056#M215016</link>
      <description>&lt;P&gt;One basic approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=abc;
  class dsc;
  table n,
        dsc all='Total'
  ;
run;&lt;/PRE&gt;
&lt;P&gt;If the output actually requires the ugly-to-me (n=&amp;nbsp; ) that's another story.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 16:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702056#M215016</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-27T16:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702066#M215019</link>
      <description>&lt;P&gt;I will prefer this kind of output-&lt;BR /&gt;proc sql;&lt;BR /&gt;create table temp as&lt;BR /&gt;select dsc, cat ("(n","=",count(dsc),")") as count, (select cat ("(n","=",count( dsc ),")") from abc) as total_count&lt;BR /&gt;from abc&lt;BR /&gt;group by dsc;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 17:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702066#M215019</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2020-11-27T17:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702073#M215024</link>
      <description>Use PROC FREQ - which is the most basic solution.&lt;BR /&gt;&lt;BR /&gt;PROC FREQ data=abc;&lt;BR /&gt;table dsc;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 27 Nov 2020 17:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-of-data/m-p/702073#M215024</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-27T17:23:47Z</dc:date>
    </item>
  </channel>
</rss>

