<?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 count in proc report in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467851#M70738</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Using your data of 101 rows, you can just use N and PCTN directly in the COLUMN statement. Since you want the label for N to be different each time it appears, that means you have to use an alias for the 2nd reference to N in order to be able to specify a different label.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I don't think it looks right not to have the percent for the NO row, but that's your requirement. BREAK AFTER ACTIVE did not look right, so I took it out and let the RBREAK stay:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="use_n_pctn.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21052i8F90F088BC0B7ABF/image-size/large?v=v2&amp;amp;px=999" role="button" title="use_n_pctn.png" alt="use_n_pctn.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Note that if you use the PERCENT9.2 format for the percent number, that rounding will occur.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Hope this helps,&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jun 2018 21:36:53 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2018-06-05T21:36:53Z</dc:date>
    <item>
      <title>how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467602#M70706</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;how to count gender&amp;nbsp; in proc report&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;report&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=sashelp.class;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;columns&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; age sex height weight sex=a;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; sex/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;group&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;define&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; a /&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;n&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;SS&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 09:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467602#M70706</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-06-05T09:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467603#M70707</link>
      <description>&lt;P&gt;You would use a computed block:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/forum2008/188-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/188-2008.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, my recommendation is don't.&amp;nbsp; Proc report is a reporting procedure.&amp;nbsp; There are other procedures - summary, means etc. which are far better at manipulating the data, and those should be used instead.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 09:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467603#M70707</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-05T09:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467654#M70711</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Proc Report has all the same statistics available as TABULATE except for kurtosis and skewness and the special PCTSUM statistics (and since you have the COMPUTE block, you can always calculate the ROWPCTN and ROWPCTSUM, COLPCTN and COLPCTSUM statistics in PROC REPORT).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use PROC REPORT for a report like the ones produced by the code below. Any of these examples will work. The N statistic can always be used in a COLUMN statement, directly. Other statistics need to be used with an analysis variable. Here are some examples:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.class;
columns  sex n ('Mean' height weight);
define sex/group;
define n /'Count';
define height/mean f=6.2;
define weight/mean f=6.2;
run;

proc report data=sashelp.class;
columns  sex n age,(mean) height,(mean) weight,(min);
define sex/group;
define n / 'Count';
define age / analysis f=6.2;
define height/ analysis f=6.2;
define weight / analysis f=6.2;
run;

proc report data=sashelp.class;
columns sex age n height,(mean) weight,(min);
define sex/group;
define age / group;
define n / 'Count';
define height/ analysis f=6.2;
define weight / analysis f=6.2;
break after sex / summarize style=Header;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PROC REPORT can do a lot of the same things as other summary procedures, the syntax is different. There are a lot of good papers and books on PROC REPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 13:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467654#M70711</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-06-05T13:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467701#M70716</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;active &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;no of active &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;status&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;no of status&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;% &lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;open&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;open&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;%42.85&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TOTAL&lt;/TD&gt;&lt;TD&gt;350&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;350&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can we calculate %age of status&amp;nbsp;(open) vs No of active (only YES). in separate column&lt;/P&gt;&lt;P&gt;&amp;nbsp;my output should be like in % column and also I need total&lt;/P&gt;&lt;P&gt;I think we can calculate like this &amp;nbsp;% =(150/(200+150)*100&amp;nbsp; but in NO row I have to get 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;SS&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 15:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467701#M70716</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-06-05T15:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467704#M70717</link>
      <description>&lt;P&gt;Hi, Can you post some test data in the form of a datastep and show the actual code that you've tried?&lt;BR /&gt;&lt;BR /&gt;In a PROC REPORT COMPUTE block, you could assign a value of 0 to the cell for %, if you need to, but without data to test with, it is hard to understand what you want to do. And the structure of the data makes a difference to how you write the PROC REPORT code, so without data and code, it's impossible to answer your question. (Also, in your formula, with PROC REPORT you don't need to multiply by 100 because the PERCENT format will automatically multiply by 100 for you. And in PROC TABULATE, you don't need to multiply by 100 because TABULATE automatically multiplies by 100 for percents. In any case, for PROC REPORT, you don't need the extra *100.)&lt;BR /&gt;&lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 15:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467704#M70717</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-06-05T15:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467707#M70718</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;test data.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile cards;
input active$ status$;
cards;
NO OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
NO OPEN
NO OPEN
NO OPEN
NO OPEN
YES OPEN
NO OPEN
YES OPEN
NO OPEN
YES OPEN
NO OPEN
YES OPEN
NO OPEN
YES OPEN
NO OPEN
YES OPEN
NO OPEN
YES OPEN
NO OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
NO OPEN
NO OPEN
NO OPEN
NO OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
NO OPEN
NO OPEN
NO OPEN
NO OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
NO OPEN
NO OPEN
NO OPEN
NO OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
NO OPEN
NO OPEN
NO OPEN
NO OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
YES OPEN
NO OPEN
NO OPEN
NO OPEN
NO OPEN
YES OPEN

;
run;

proc report data=a out=test(drop=_BREAK_);
columns active n status n test;
define active/group;
define status / group;
define n / 'active Count';
define n / 'status Count';
define test / '%' computed;

break after active / summarize style=Header;
rbreak after/summarize;
compute test;
if active='YES' then test=n/n2.sum;
else test=0;
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SS.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 16:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467707#M70718</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-06-05T16:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467793#M70720</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; Thanks, I'm teaching today, so it will take me a while to use your data. The challenge that I see on a quick look is this:&lt;BR /&gt;1) you can't use 2 define statements for n. You'll have to use a different technique.&lt;BR /&gt;2) for a simple PCTN, you don't need to do your own division as you show with the TEST item. You can just use the PCTN statistic. You'll need to use format=PERCENT9.2 or PERCENT10.3 to get the right number and percent sign. Also, I don't think you want the BREAK AFTER ACTIVE, I think you just want the RBREAK statement to get the table you previously showed. And, you don't say what you want to appear on the TOTAL line -- do you want to still see a 0 for the NO but see 100% on the TOTAL line?&lt;BR /&gt;&lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 18:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467793#M70720</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-06-05T18:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467851#M70738</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Using your data of 101 rows, you can just use N and PCTN directly in the COLUMN statement. Since you want the label for N to be different each time it appears, that means you have to use an alias for the 2nd reference to N in order to be able to specify a different label.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I don't think it looks right not to have the percent for the NO row, but that's your requirement. BREAK AFTER ACTIVE did not look right, so I took it out and let the RBREAK stay:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="use_n_pctn.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21052i8F90F088BC0B7ABF/image-size/large?v=v2&amp;amp;px=999" role="button" title="use_n_pctn.png" alt="use_n_pctn.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Note that if you use the PERCENT9.2 format for the percent number, that rounding will occur.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Hope this helps,&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 21:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467851#M70738</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-06-05T21:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467982#M70742</link>
      <description>&lt;P&gt;Thanks a lot &amp;nbsp;Cynthia,&lt;/P&gt;&lt;P&gt;as you said my NOs also should be in % but I want to see the % in total row too. like below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;active &lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;active count&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;status&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;status count&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;%&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;open&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;0.000%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;YES&lt;/TD&gt;&lt;TD&gt;69&lt;/TD&gt;&lt;TD&gt;open&lt;/TD&gt;&lt;TD&gt;69&lt;/TD&gt;&lt;TD&gt;68.317%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;TOTAL&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;68.317%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=a out=test(drop=_BREAK_);
columns active n status n=n2 pctn;
define active/group;
define status / group;
define n / 'active Count';
define n / 'status Count';
define pctn / '%' f=percent9.2;
/*break after active / summarize style=Header;*/
rbreak after/summarize style=Header;
compute pctn;
if active='NO' then do;
pctn=0;
end;
endcomp;
compute after;
active='TOTAL';

endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If I run that above code I am getting 100% in TOTAL row but I&amp;nbsp;looking for &amp;nbsp;68.32%.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;SS&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 07:45:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/467982#M70742</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-06-06T07:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/468070#M70743</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If that's what you want, then you'd have to use a temporary variable in PROC REPORT to save the YES percent value on the YES row and then instead of what I show for COMPUTE AFTER, where I have&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;pctn=.;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you would have something different...probably like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;compute pctn;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if active = 'NO' then do;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pctn = 0;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;else if active = 'YES' then do;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; yespct = pctn;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; endcomp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; compute after;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; active = 'TOTAL';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; &lt;FONT color="#FF0000"&gt;&amp;nbsp;pctn = yespct;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; endcomp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above code, the ELSE condition creates a temporary variable called YESPCT and the nice thing about PROC REPORT is that the temporary variable values are automatically retained. So in the COMPUTE AFTER block, at the bottom of the report, the temporary variable value for YESPCT can be assigned to the PCTN column on the final summary row of the report. Your original desired report had just 0, and for that you need the CALL DEFINE Statement on the NO row. But if you want 0.00% (which is technically not the right percentage number), then you don't need the CALL DEFINE that I originally showed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; There are a couple of good books in the SAS Bookstore on PROC REPORT. If you decide you want to learn more about PROC REPORT and how it works, look for books by Jane Eslinger, Art Carpenter and Lisa Fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 14:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/468070#M70743</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-06-06T14:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567555#M75135</link>
      <description>&lt;P&gt;I'm confused now. I tried above tips and still not working for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so, here is my final dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x1. &amp;nbsp; x2 &amp;nbsp; &amp;nbsp;x3. &amp;nbsp; x4&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0. &amp;nbsp; &amp;nbsp;1. &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;0. &amp;nbsp; &amp;nbsp; &amp;nbsp;0. &amp;nbsp; &amp;nbsp;1. &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; &amp;nbsp; &amp;nbsp;1. &amp;nbsp; &amp;nbsp;0. &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; &amp;nbsp; &amp;nbsp;0. &amp;nbsp; &amp;nbsp;0. &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; &amp;nbsp; &amp;nbsp;0. &amp;nbsp; &amp;nbsp; 0. &amp;nbsp; &amp;nbsp;0&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;&lt;P&gt;I need to count how many ones for each variable. and produce the proc report as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x1. &amp;nbsp; x2. &amp;nbsp;x3. &amp;nbsp;x4&lt;/P&gt;&lt;P&gt;n. &amp;nbsp; &amp;nbsp; 4. &amp;nbsp; &amp;nbsp; 1. &amp;nbsp; &amp;nbsp;2. &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 08:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567555#M75135</guid>
      <dc:creator>sharuu_00</dc:creator>
      <dc:date>2019-06-20T08:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567624#M75140</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;I'm confused. is it that you don't need the percents anymore? Why do your numbers all have periods after them. What code have you tried, this seems to be a different type of report than your previous report. &lt;BR /&gt;&lt;BR /&gt;A value of 0 would "count" as a non-missing observation as shown in the example code and output below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fakedata1.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30430i00C410C3A7830D2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="fakedata1.png" alt="fakedata1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are your values 0 or . (missing) or should the 0 values be ignored??? For example, if the 0 values were missing or ., then you'd get this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fakedata2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30431i8485CEC0218DB473/image-size/large?v=v2&amp;amp;px=999" role="button" title="fakedata2.png" alt="fakedata2.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 16:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567624#M75140</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-06-20T16:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567815#M75148</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I entered fake variables and as I entered and given space period appeared thats all. &amp;nbsp;I need to only count the ones for each variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 01:04:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567815#M75148</guid>
      <dc:creator>sharuu_00</dc:creator>
      <dc:date>2019-06-21T01:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567929#M75153</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If you only need to count the variables with 1, then the SUM statistic will work in this case. (It would NOT work if your values were 3 and 5, for example, but in this case, you can use SUM to generate what you want with either PROC REPORT or PROC TABULATE, as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fake_data_sum.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30458iE361FB9272EAE120/image-size/large?v=v2&amp;amp;px=999" role="button" title="fake_data_sum.png" alt="fake_data_sum.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/567929#M75153</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-06-21T14:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576553#M75483</link>
      <description>Data.is&lt;BR /&gt;Student Subject Semister Marks&lt;BR /&gt;A01 math1 1 60&lt;BR /&gt;A02. Math1 1 76&lt;BR /&gt;A03. Math1 1 67&lt;BR /&gt;A01. Math1 2 60&lt;BR /&gt;A02. Math2 2 70&lt;BR /&gt;A03. Math3 2 69&lt;BR /&gt;A01. Math1 3 69&lt;BR /&gt;A02. Math2 3 56&lt;BR /&gt;A03. Math3 3 80&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How to get the total Marks of math1 ,math2 and math3&lt;BR /&gt;For all the semisters&lt;BR /&gt;Like&lt;BR /&gt;A01. Math1 189&lt;BR /&gt;Math2 192&lt;BR /&gt;Math3. 207&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;By using proc report how we will get output like this....</description>
      <pubDate>Thu, 25 Jul 2019 12:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576553#M75483</guid>
      <dc:creator>sasuser123123</dc:creator>
      <dc:date>2019-07-25T12:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576609#M75484</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Thanks for posting some data, but what PROC REPORT code have you tried? What is your destination of choice for the output report? HTML, RTF, PDF???&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; Also, I'm confused by your output. A01 student does not have any rows for Math2 or Math3. Why do you show student A01 on the output, but not the other students? That doesn't make sense to me. Either you want to see all the students and their summarized scores or you don't want the students. It doesn't make sense to me to only show A01 and not student A02 or A03.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 14:29:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576609#M75484</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-07-25T14:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576661#M75486</link>
      <description>Proc report data=dataset;&lt;BR /&gt;Column student Subject marks;&lt;BR /&gt;Define student/group;&lt;BR /&gt;Define subject/group;&lt;BR /&gt;Define marks/analysis sum;&lt;BR /&gt;Break after student/summarize;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;Thank you!!&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Jul 2019 15:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576661#M75486</guid>
      <dc:creator>sasuser123123</dc:creator>
      <dc:date>2019-07-25T15:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576669#M75487</link>
      <description>May Be I gave the wrong data to you...</description>
      <pubDate>Thu, 25 Jul 2019 15:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576669#M75487</guid>
      <dc:creator>sasuser123123</dc:creator>
      <dc:date>2019-07-25T15:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576670#M75488</link>
      <description>Thank you so much Cynthia_Sas for your response..</description>
      <pubDate>Thu, 25 Jul 2019 15:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576670#M75488</guid>
      <dc:creator>sasuser123123</dc:creator>
      <dc:date>2019-07-25T15:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to count in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576681#M75489</link>
      <description>Do you still have a question or did your code work?&lt;BR /&gt;Cynthia</description>
      <pubDate>Thu, 25 Jul 2019 16:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-count-in-proc-report/m-p/576681#M75489</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-07-25T16:36:13Z</dc:date>
    </item>
  </channel>
</rss>

