<?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: Table with the percentage of the total. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711315#M219106</link>
    <description>&lt;P&gt;&lt;SPAN&gt;you&amp;nbsp;also need to take the sum of the desired region per genre instead of just the sum of the game, that's why I put&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;sum(region_sale)&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;instead of&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;region_sale.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;After making this change the result is the same?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jan 2021 22:38:46 GMT</pubDate>
    <dc:creator>Angel_Larrion</dc:creator>
    <dc:date>2021-01-13T22:38:46Z</dc:date>
    <item>
      <title>Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711295#M219095</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to create table, that showing the percentage of each region in the total sales.&lt;/P&gt;&lt;P&gt;My data:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pawel__0-1610573574283.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53482iE10FC9B8703EEF3D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pawel__0-1610573574283.png" alt="Pawel__0-1610573574283.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I wrote something like this:&lt;/P&gt;&lt;PRE&gt;proc sql;
create table want8 as
Select Genre, NA_Sales/sum(EU_Sales,NA_Sales, JP_Sales, Other_Sales) as NA_Sales format=percent8.2, EU_Sales/sum(EU_Sales,NA_Sales, JP_Sales, Other_Sales)
as EU_Sales format=percent8.2, JP_Sales/sum(EU_Sales,NA_Sales, JP_Sales, Other_Sales) as JP_Sales format=percent8.2
from games order by Genre;
quit;
run;
proc print data=want8;
run;&lt;/PRE&gt;&lt;P&gt;But I get this result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pawel__1-1610573718029.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53483i409E28A9878C54F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pawel__1-1610573718029.png" alt="Pawel__1-1610573718029.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I wonder why it doesn't group correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 21:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711295#M219095</guid>
      <dc:creator>Pawel_</dc:creator>
      <dc:date>2021-01-13T21:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711308#M219101</link>
      <description>&lt;P&gt;With the code you showed us you are calculating the percentage of each region per game (i.e. each row in the output table is a game ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you want to obtain? (i.e. What does a row represent in the desired output table?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 22:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711308#M219101</guid>
      <dc:creator>Angel_Larrion</dc:creator>
      <dc:date>2021-01-13T22:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711309#M219102</link>
      <description>I want to calculate percentage of each region per genre.</description>
      <pubDate>Wed, 13 Jan 2021 22:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711309#M219102</guid>
      <dc:creator>Pawel_</dc:creator>
      <dc:date>2021-01-13T22:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711310#M219103</link>
      <description>&lt;P&gt;then you have to group by genre.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want8 as
Select Genre, sum(NA_Sales)/sum(EU_Sales,NA_Sales, JP_Sales, Other_Sales) as NA_Sales format=percent8.2, sum(EU_Sales)/sum(EU_Sales,NA_Sales, JP_Sales, Other_Sales)
as EU_Sales format=percent8.2, sum(JP_Sales)/sum(EU_Sales,NA_Sales, JP_Sales, Other_Sales) as JP_Sales format=percent8.2
from games group by Genre order by Genre;
quit;
run;
proc print data=want8;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this code should work&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 22:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711310#M219103</guid>
      <dc:creator>Angel_Larrion</dc:creator>
      <dc:date>2021-01-13T22:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711312#M219104</link>
      <description>&lt;P&gt;Unfortunately the result is the same.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pawel__0-1610577048363.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53486iAD1EBEC2907D8F0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pawel__0-1610577048363.png" alt="Pawel__0-1610577048363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 22:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711312#M219104</guid>
      <dc:creator>Pawel_</dc:creator>
      <dc:date>2021-01-13T22:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711315#M219106</link>
      <description>&lt;P&gt;&lt;SPAN&gt;you&amp;nbsp;also need to take the sum of the desired region per genre instead of just the sum of the game, that's why I put&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;sum(region_sale)&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;instead of&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;region_sale.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;After making this change the result is the same?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 22:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711315#M219106</guid>
      <dc:creator>Angel_Larrion</dc:creator>
      <dc:date>2021-01-13T22:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711317#M219107</link>
      <description>&lt;P&gt;Sorry, I didn't notice this change. However, now the result is this :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pawel__0-1610577726510.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53487i474A77C327B80304/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Pawel__0-1610577726510.png" alt="Pawel__0-1610577726510.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 22:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711317#M219107</guid>
      <dc:creator>Pawel_</dc:creator>
      <dc:date>2021-01-13T22:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Table with the percentage of the total.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711318#M219108</link>
      <description>&lt;P&gt;instead of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;sum(EU_Sales,NA_Sales, JP_Sales, Other_Sales)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can put&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;sum(EU_Sales+NA_Sales+ JP_Sales+ Other_Sales)&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want8 as
Select Genre, sum(NA_Sales)/sum(EU_Sales+NA_Sales+ JP_Sales+ Other_Sales) as NA_Sales format=percent8.2, sum(EU_Sales)/sum(EU_Sales+NA_Sales+ JP_Sales+ Other_Sales)
as EU_Sales format=percent8.2, sum(JP_Sales)/sum(EU_Sales+NA_Sales+ JP_Sales+ Other_Sales) as JP_Sales format=percent8.2
from games group by Genre order by Genre;
quit;
run;
proc print data=want8;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;that should work.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 22:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Table-with-the-percentage-of-the-total/m-p/711318#M219108</guid>
      <dc:creator>Angel_Larrion</dc:creator>
      <dc:date>2021-01-13T22:53:14Z</dc:date>
    </item>
  </channel>
</rss>

