<?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: Proc Tabulate calculating percentages in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/396005#M95571</link>
    <description>&lt;P&gt;Beautiful! Works like a charm! Thanks!!!&lt;/P&gt;</description>
    <pubDate>Thu, 14 Sep 2017 16:33:25 GMT</pubDate>
    <dc:creator>sharonlee</dc:creator>
    <dc:date>2017-09-14T16:33:25Z</dc:date>
    <item>
      <title>Proc Tabulate calculating percentages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/395783#M95510</link>
      <description>&lt;P&gt;I'm having problems using PROC TABULATE to calculate percentages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what my dataset looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;pass&lt;/TD&gt;&lt;TD&gt;month&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;name1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;jan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;name1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;jan&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;name2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;mar&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can use proc freq to calculate the column percentages for each month, as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data = test;&lt;BR /&gt;tables pass*month;&lt;BR /&gt;by name;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I'm using the "BY" statement, it generates a separate table for each name. I'd like to use PROC TABULATE to have all the data in one table. Here is my proposed code, but it doesn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc tabulate data=test;&lt;BR /&gt;class name month;&lt;BR /&gt;table name*month*&lt;BR /&gt;(n='Total'*f=4.&lt;BR /&gt;ROWPCTN= 'Percentage of pass')&lt;BR /&gt;,&lt;BR /&gt;month/rts=60 box='Percentage of pass';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong? It only calculates the total "N" but I want it to calculate "N" for each month, as in the proc freq column percentage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you kindly.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 22:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/395783#M95510</guid>
      <dc:creator>sharonlee</dc:creator>
      <dc:date>2017-09-13T22:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate calculating percentages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/395786#M95513</link>
      <description>&lt;P&gt;Try adding it as a 'page'? You can also specify the levels by moving where the statistics are calculated using the ALL keyword.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;table name, month*
(n='Total'*f=4.
ROWPCTN= 'Percentage of pass')
,
month/rts=60 box='Percentage of pass';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Sep 2017 22:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/395786#M95513</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-13T22:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate calculating percentages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/395789#M95515</link>
      <description>&lt;P&gt;With a 0/1 coded variable the sum = number of ones or pass (assuming 1 means pass), the mean will give you a percentage:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=test;
   class name month;
   var pass;
   table name*month,
         pass=''*(sum='Number pass'*f=best5. mean='Percentage Pass'*f=percent8.1)
   ;
run;&lt;/PRE&gt;
&lt;P&gt;N for Pass would give you the number of tests administered that received a score.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 22:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/395789#M95515</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-13T22:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate calculating percentages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/396005#M95571</link>
      <description>&lt;P&gt;Beautiful! Works like a charm! Thanks!!!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 16:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-calculating-percentages/m-p/396005#M95571</guid>
      <dc:creator>sharonlee</dc:creator>
      <dc:date>2017-09-14T16:33:25Z</dc:date>
    </item>
  </channel>
</rss>

