<?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: calculate pct from total row for each numeric cell in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculate-pct-from-total-row-for-each-numeric-cell/m-p/779756#M248401</link>
    <description>&lt;P&gt;Do you want this in a data set ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the fractions will be character values, right?&lt;/P&gt;</description>
    <pubDate>Thu, 11 Nov 2021 12:00:44 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-11-11T12:00:44Z</dc:date>
    <item>
      <title>calculate pct from total row for each numeric cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-pct-from-total-row-for-each-numeric-cell/m-p/779755#M248400</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have a summary table (data set) with number of customers in each category (Z1,Z2).&lt;/P&gt;
&lt;P&gt;What is the way to dispaly this table with percent from total.&lt;/P&gt;
&lt;P&gt;So in first row I expect to get:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;A Q1 500/2000 300/2000 200/2000 400/2000 600/2000&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;in&amp;nbsp;second&amp;nbsp;row&amp;nbsp;i&amp;nbsp;expect&amp;nbsp;to&amp;nbsp;see&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;A Q2 600/3200 200/3200 1200/3200 900/3200 300/3200&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;and&amp;nbsp;so&amp;nbsp;on&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

Data have;
Input Z1 $ Z2 $ X1 X2 X3 X4 X5;
cards;
A Q1 500 300 200 400 600
A Q2 600 200 1200 900 300
A Q3 300 200 200 700 1000
B Q1 500 800 1300 1000 1500
B Q2 400 200 300 600 500
B Q3 500 600 800 700 300
C Q1 900 800 300 800 1200
C Q2 400 200 700 200 700
C Q3 400 500 600 300 600
;
Run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 11:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-pct-from-total-row-for-each-numeric-cell/m-p/779755#M248400</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-11-11T11:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: calculate pct from total row for each numeric cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-pct-from-total-row-for-each-numeric-cell/m-p/779756#M248401</link>
      <description>&lt;P&gt;Do you want this in a data set ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the fractions will be character values, right?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 12:00:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-pct-from-total-row-for-each-numeric-cell/m-p/779756#M248401</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-11-11T12:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: calculate pct from total row for each numeric cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-pct-from-total-row-for-each-numeric-cell/m-p/779758#M248402</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array x{*} x:;
array y{5} y1-y5;
format y: percent7.2;
do i = 1 to 5;
  y{i} = x{i} / sum(of x{*});
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 12:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-pct-from-total-row-for-each-numeric-cell/m-p/779758#M248402</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-11T12:18:48Z</dc:date>
    </item>
  </channel>
</rss>

