<?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: Percentages calculations based on the total of another table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Percentages-calculations-based-on-the-total-of-another-table/m-p/918193#M41095</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to divide each value of the first table (have)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So in this example, the second data set for me is WORK.CCH1. Naturally, you would change the code based upon your actual data set name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table z as select nobs from dictionary.tables where libname="WORK" and memname="CCH1";
quit;

data want;
    if _n_=1 then set z;
    set have;
    n=n/nobs;
    profession1=profession1/nobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 Feb 2024 11:59:55 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-02-28T11:59:55Z</dc:date>
    <item>
      <title>Percentages calculations based on the total of another table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Percentages-calculations-based-on-the-total-of-another-table/m-p/918192#M41094</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following table:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input N Profession1 Profession2 ;&lt;BR /&gt;cards;&lt;BR /&gt;0 12 1&lt;BR /&gt;10 34 56&lt;BR /&gt;20 2 3&lt;BR /&gt;50 56 13&lt;BR /&gt;60 4 76&lt;BR /&gt;70 78 77&lt;BR /&gt;90 12 90&lt;BR /&gt;100 56 2&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you have another table you know has N rows.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to divide each value of the first table (have) by this N (it can change so I cannot set every time the exact value that I know what it is)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 11:52:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Percentages-calculations-based-on-the-total-of-another-table/m-p/918192#M41094</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-02-28T11:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Percentages calculations based on the total of another table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Percentages-calculations-based-on-the-total-of-another-table/m-p/918193#M41095</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to divide each value of the first table (have)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So in this example, the second data set for me is WORK.CCH1. Naturally, you would change the code based upon your actual data set name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table z as select nobs from dictionary.tables where libname="WORK" and memname="CCH1";
quit;

data want;
    if _n_=1 then set z;
    set have;
    n=n/nobs;
    profession1=profession1/nobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2024 11:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Percentages-calculations-based-on-the-total-of-another-table/m-p/918193#M41095</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-28T11:59:55Z</dc:date>
    </item>
  </channel>
</rss>

