<?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 Count and Percentage? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518531#M140350</link>
    <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to calculate the counts&amp;nbsp;in Column 'A'&amp;nbsp; where the number is '1' or '0' separately?&amp;nbsp;&amp;nbsp; And the percentage where '1' over '0', and '1' over _all_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA TEST;
	INPUT id agree;
	datalines; 
	1 1
	2 1
	3 0
	4 1
	5 0
	6 1
	7 0
	8 0
	9 0
	10 0
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result I am looking for is:&lt;/P&gt;
&lt;P&gt;Yes: 4&lt;/P&gt;
&lt;P&gt;Yes percentage: 40%&lt;/P&gt;
&lt;P&gt;No: 6&lt;/P&gt;
&lt;P&gt;No percentage:60%&lt;/P&gt;</description>
    <pubDate>Tue, 04 Dec 2018 19:18:00 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2018-12-04T19:18:00Z</dc:date>
    <item>
      <title>Count and Percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518531#M140350</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to calculate the counts&amp;nbsp;in Column 'A'&amp;nbsp; where the number is '1' or '0' separately?&amp;nbsp;&amp;nbsp; And the percentage where '1' over '0', and '1' over _all_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA TEST;
	INPUT id agree;
	datalines; 
	1 1
	2 1
	3 0
	4 1
	5 0
	6 1
	7 0
	8 0
	9 0
	10 0
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result I am looking for is:&lt;/P&gt;
&lt;P&gt;Yes: 4&lt;/P&gt;
&lt;P&gt;Yes percentage: 40%&lt;/P&gt;
&lt;P&gt;No: 6&lt;/P&gt;
&lt;P&gt;No percentage:60%&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 19:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518531#M140350</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-12-04T19:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518537#M140351</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
DATA TEST;
	INPUT id agree;
	datalines; 
	1 1
	2 1
	3 0
	4 1
	5 0
	6 1
	7 0
	8 0
	9 0
	10 0
	;
run;


proc sql;
create table want as
select agree, count(agree)/(select count(*) from test)*100 as c
from test
group by agree;
quit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Dec 2018 19:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518537#M140351</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-04T19:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518538#M140352</link>
      <description>&lt;P&gt;With percent format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select agree, count(agree)/(select count(*) from test) as c format=percent.
from test
group by agree;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Dec 2018 19:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518538#M140352</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-04T19:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Percentage?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518547#M140356</link>
      <description>&lt;P&gt;And a Proc Tabulate solution&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=test;
   class agree;
   table agree,
         n colpctn;
run;&lt;/PRE&gt;
&lt;P&gt;if people are to read the result and a data set not needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2018 19:53:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-and-Percentage/m-p/518547#M140356</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-04T19:53:17Z</dc:date>
    </item>
  </channel>
</rss>

