<?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 Does the Proc tabulate carry the column percent calculation function? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Does-the-Proc-tabulate-carry-the-column-percent-calculation/m-p/852293#M336923</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a sample code below; I would like to calculate the age and ICU column percent of Sum_cost.&amp;nbsp; Is there a way to approach it? Thanks.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=DataIn;
  var Cost_Sum;
  class age ICU;
  table (age ICU),(Cost_Sum) *(N mean std median p25 p75 sum);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Jan 2023 15:38:11 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2023-01-05T15:38:11Z</dc:date>
    <item>
      <title>Does the Proc tabulate carry the column percent calculation function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-the-Proc-tabulate-carry-the-column-percent-calculation/m-p/852293#M336923</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a sample code below; I would like to calculate the age and ICU column percent of Sum_cost.&amp;nbsp; Is there a way to approach it? Thanks.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=DataIn;
  var Cost_Sum;
  class age ICU;
  table (age ICU),(Cost_Sum) *(N mean std median p25 p75 sum);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Jan 2023 15:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-the-Proc-tabulate-carry-the-column-percent-calculation/m-p/852293#M336923</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-01-05T15:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Does the Proc tabulate carry the column percent calculation function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-the-Proc-tabulate-carry-the-column-percent-calculation/m-p/852297#M336925</link>
      <description>Hi:&lt;BR /&gt;  PROC TABULATE has quite a few "percent" statistics: ROWPCTN, ROWPCTSUM, PCTN, PCTSUM, COLPCTN, COLPCTSUM, etc. In addition, with PCTN and PCTSUM, you can ask for a custom denominator. I generally recommend using the built in statistics first to see whether there's one that suits your purposes. The TABULATE documentation has good examples of the percent statistics and how to request a custom denominator: &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0vdza4puzkcghn1j5xtqfb4sahr.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0vdza4puzkcghn1j5xtqfb4sahr.htm&lt;/A&gt; and this is an excellent paper on the topic: &lt;A href="https://support.sas.com/resources/papers/proceedings13/134-2013.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings13/134-2013.pdf&lt;/A&gt; &lt;BR /&gt;Cynthia</description>
      <pubDate>Thu, 05 Jan 2023 16:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-the-Proc-tabulate-carry-the-column-percent-calculation/m-p/852297#M336925</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2023-01-05T16:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Does the Proc tabulate carry the column percent calculation function?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Does-the-Proc-tabulate-carry-the-column-percent-calculation/m-p/852308#M336932</link>
      <description>&lt;P&gt;Hi;&lt;/P&gt;
&lt;P&gt;While this might be a bit over-simplified, perhaps it'll get you on your way:&lt;/P&gt;
&lt;P&gt;data datain;&lt;BR /&gt;infile datalines;&lt;BR /&gt;input age icu cost_sum;&lt;BR /&gt;datalines;&lt;BR /&gt;17 1 10000&lt;BR /&gt;65 1 13250&lt;BR /&gt;44 2 6200&lt;BR /&gt;89 2 23000&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;proc format;&lt;BR /&gt;picture perc (round) low-high='09.99%' (multiplier=100);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc tabulate data=datain;&lt;BR /&gt;var cost_sum;&lt;BR /&gt;class age icu;&lt;BR /&gt;table(age icu),(cost_sum) * (n mean std median p25 p75 sum pctsum *f=perc.);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;I've used the pctsum keyword, one of Cynthia's suggestions, but often programmers have difficulty getting the needed '%' sign to appear.&amp;nbsp; &amp;nbsp;To do this, you'll need to create your own format as I've done above, using a 'picture' statement instead of the usual value statement.&amp;nbsp; &amp;nbsp; Here are some results using the make-believe dataset above:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="donricardo_0-1672939424269.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79065iF34F5907B4737C6D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="donricardo_0-1672939424269.png" alt="donricardo_0-1672939424269.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 17:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Does-the-Proc-tabulate-carry-the-column-percent-calculation/m-p/852308#M336932</guid>
      <dc:creator>donricardo</dc:creator>
      <dc:date>2023-01-05T17:23:55Z</dc:date>
    </item>
  </channel>
</rss>

