<?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 Percent in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716134#M221273</link>
    <description>&lt;P&gt;Hi:&lt;BR /&gt;Without your WORK.BOOK data, no one can run your code. Can you either post your data, post some test data, or rework your example using one of the SASHELP datasets? I think from what you describe that you need to switch to the PCTSUM statistic in the table. But I'm not entirely sure. Here's an example using N and PCTN and then SUM and PCTSUM for a numeric variable:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1612285343114.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54241iADDA31D2BF783970/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1612285343114.png" alt="Cynthia_sas_0-1612285343114.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
    <pubDate>Tue, 02 Feb 2021 17:03:21 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2021-02-02T17:03:21Z</dc:date>
    <item>
      <title>Proc Tabulate Percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716120#M221262</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to work out how to get a percentage within my proc tabulate for the sum of a variable within column, without having a column variable. I have tired the below code. Though this only produces the col % for the total population. Does any body know how to get it to produce the % for the Value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc tabulate data=book;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;title 'Age band';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;table Pet_Type ="Pet'', (n pctn Value colpctn&amp;lt;Value&amp;gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;class Pet_type /missing;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var Value;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What this gives me is: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Total number falling within each band (N)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;% for the t&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;total summed up value associated to the Pets&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;% for the col for total again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have shown two tables with the current vs what i wish to produce.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Current output&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Pet&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N&amp;nbsp; &amp;nbsp; PctN&amp;nbsp; &amp;nbsp;Value&amp;nbsp; &amp;nbsp; ColPctN Value&lt;BR /&gt;a. Dog&amp;nbsp; &amp;nbsp; &amp;nbsp; 80&amp;nbsp; &amp;nbsp;30.65&amp;nbsp; &amp;nbsp;15000&amp;nbsp; &amp;nbsp;30.65&lt;BR /&gt;b. Cat&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;74&amp;nbsp; &amp;nbsp;28.35&amp;nbsp; &amp;nbsp;10000&amp;nbsp; &amp;nbsp;28.35&lt;BR /&gt;c. Rodent 42&amp;nbsp; &amp;nbsp;16.09&amp;nbsp; &amp;nbsp;5000&amp;nbsp; &amp;nbsp; &amp;nbsp;16.09&lt;BR /&gt;d. Fish&amp;nbsp; &amp;nbsp; &amp;nbsp; 55&amp;nbsp; &amp;nbsp;21.07&amp;nbsp; 8000&amp;nbsp; &amp;nbsp; &amp;nbsp; 21.07&lt;BR /&gt;e. Other&amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp;3.83&amp;nbsp; &amp;nbsp;1000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3.83&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Expected Output&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pet&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N&amp;nbsp; &amp;nbsp; PctN&amp;nbsp; &amp;nbsp;Value&amp;nbsp; &amp;nbsp; ColPctN Val&lt;BR /&gt;a. Dog&amp;nbsp; &amp;nbsp; &amp;nbsp; 80&amp;nbsp; &amp;nbsp;30.65&amp;nbsp; &amp;nbsp;15000&amp;nbsp; &amp;nbsp;38.46&lt;BR /&gt;b. Cat&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;74&amp;nbsp; &amp;nbsp;28.35&amp;nbsp; &amp;nbsp;10000&amp;nbsp; &amp;nbsp;25.64&lt;BR /&gt;c. Rodent 42&amp;nbsp; &amp;nbsp;16.09&amp;nbsp; &amp;nbsp;5000&amp;nbsp; &amp;nbsp; &amp;nbsp;12.82&lt;BR /&gt;d. Fish&amp;nbsp; &amp;nbsp; &amp;nbsp; 55&amp;nbsp; &amp;nbsp;21.07&amp;nbsp; 8000&amp;nbsp; &amp;nbsp; &amp;nbsp; 20.51&lt;BR /&gt;e. Other&amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp;3.83&amp;nbsp; &amp;nbsp;1000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2.56&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the expected output possible within an proc tabulate without a column header?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 16:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716120#M221262</guid>
      <dc:creator>Mick_bill</dc:creator>
      <dc:date>2021-02-02T16:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716134#M221273</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;Without your WORK.BOOK data, no one can run your code. Can you either post your data, post some test data, or rework your example using one of the SASHELP datasets? I think from what you describe that you need to switch to the PCTSUM statistic in the table. But I'm not entirely sure. Here's an example using N and PCTN and then SUM and PCTSUM for a numeric variable:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1612285343114.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54241iADDA31D2BF783970/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1612285343114.png" alt="Cynthia_sas_0-1612285343114.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 17:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716134#M221273</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-02-02T17:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716138#M221276</link>
      <description>&lt;P&gt;Without your starting data set there really isn't any way to see if what you want is practical in Proc Tabulate.&lt;/P&gt;
&lt;P&gt;Proc tabulate to use a variable in a Pctn&amp;lt;var&amp;gt; will require the variable to be in the table somewhere, and pretty picky about where it can be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure that you don't want colpctsum of Value?&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=book;
title 'Age band';
table Pet_Type ="Pet'', 
n pctn Value*sum=' '  value=' '*colpctsum=' ';
class Pet_type /missing;
var Value;
run;&lt;/PRE&gt;
&lt;P&gt;You can use the variablename=' ' or statistic*' ' to provide a blank label&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 17:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716138#M221276</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-02T17:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Percent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716139#M221277</link>
      <description>&lt;P&gt;thank you, this is perfect.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2021 17:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Tabulate-Percent/m-p/716139#M221277</guid>
      <dc:creator>Mick_bill</dc:creator>
      <dc:date>2021-02-02T17:08:49Z</dc:date>
    </item>
  </channel>
</rss>

